Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directories in ignore not honoured if not in cwd #160

Open
paganwinter opened this issue Jan 5, 2021 · 0 comments
Open

Directories in ignore not honoured if not in cwd #160

paganwinter opened this issue Jan 5, 2021 · 0 comments

Comments

@paganwinter
Copy link

paganwinter commented Jan 5, 2021

Folders in the options.ignore list are not ignored if they have a trailing forward slash.

/
├── ignore-first/
|      └── file.txt
└── ignore-second/
        └── file.txt

options.ignore:

['ignore-first/', 'ignore-second']

ignore-first is not ignored in the folders list, while ignore-second is indeed ignored.

dir-glob allows specifying a cwd option as well, which is used by it to determine if an entry in the ignore list is actually a directory or not (https://github.com/kevva/dir-glob/blob/dc6e7978a641fd1e8e4329ba474fb0af65b52519/index.js#L64); this is defaulted to process.cwd(), which doesn't mark such entries as actual directories in the generated glob list.

This can be fixed by passing the original cwd option to dir-glob below:

globby/index.js

Line 105 in 7807d29

options.ignore = dirGlob.sync(options.ignore);

edit: fixed typos and formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant