-
-
Notifications
You must be signed in to change notification settings - Fork 583
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
Improve ignore paths globifying #539
Conversation
1 similar comment
Ensures that if only a directory's basename is provided (without the preceeding path, just `dirname`), it prefixes `**/` Currently when only a directory name is provided, it adds a postfix `/**` which is great for matching the entire tree ***if*** the tree is a *child* of the dir. So `path` (converted to `path/**`) can filter paths like `path/to/file.js`, **but** if `path` is actually only a directory's basename it fails to match `/some/path/to/file.js`. This can be solved by prefixing `**/path` Really helpful when only "node_modules" is provided as ignore path (like in `.gitignore` file) and it's actually some level deeper than current dir. Also adjust the postfix to add just `**` instead of `/**` based on if last char is already a `/`
2594dfd
to
e4aff97
Compare
3 similar comments
At a glance, this doesn't make sense to me. The relative-ness of the glob paths should match with the way the paths are specified for being watched, and that's how it's output. If you watch with absolute paths, your glob patterns need to reflect the entire absolute path and vice versa. If something about that isn't working as expected, we can look at it and see if we can solve for the underlying cause to make sure the paths being matched reflect the same basedir as the patterns, but automatically prefixing with Maybe instead of prefixing with |
You're right my bad. It seems it already works the way you described, I just needed to add |
So just to clarify, it only excludes either when both the watch path and exclude paths are either both relative or when both are absolute. I had a watch path as an absolute path and ignored paths as relative paths. So in this case it is required to have Would it be desirable to have it auto infer |
Better to think in terms of how globs are matched. The pattern
This is the same as the suggestion I made at the end of my comment. Might be worth it, but there might also be a risk of side effects. In your case using |
Ensures that if only a directory's basename is provided (without the preceeding path, just
dirname
), it prefixes**/
Currently when only a directory name is provided, it adds a postfix
/**
which is great for matching the entire tree _if_ the tree is a child of the dir. Sopath
(converted topath/**
) can filter paths likepath/to/file.js
, but ifpath
is actually only a directory's basename it fails to match/some/path/to/file.js
. This can be solved by prefixing**/path
Really helpful when only "node_modules" is provided as ignore path (like in
.gitignore
file).This could probably have solved #447, which if I followed correctly the solution ultimately was to add paths in similar patterns
Also adjust the postfix to add just
**
instead of/**
based on if last char is already a/