-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Custom ignore files can not be used exclusively #800
Comments
Thanks for the clear bug report! This definitely sounds like a bug, and |
By the way, ripgrep itself is not "affected" (I think) because the custom ignore file ( |
@sharkdp Yup I believe you're right. Thanks for noticing this and filing a bug. :) |
When building a ignore::WalkBuilder by disabling all standard filters and adding a custom global ignore file, the ignore file is not used. Example: let mut walker = ignore::WalkBuilder::new(dir); walker.standard_filters(false); walker.add_ignore(myfile); This makes it impossible to use the ignore crate to walk a directory with only custom ignore files. Very similar to issue BurntSushi#800 (fixed in b71a110).
When building a ignore::WalkBuilder by disabling all standard filters and adding a custom global ignore file, the ignore file is not used. Example: let mut walker = ignore::WalkBuilder::new(dir); walker.standard_filters(false); walker.add_ignore(myfile); This makes it impossible to use the ignore crate to walk a directory with only custom ignore files. Very similar to issue #800 (fixed in b71a110). PR #988
What version of the ignore crate are you using?
ignore-0.4.0
Describe your question, feature request, or bug.
It would be great if the custom ignore files (that are available since ignore-0.4.0) could be used exclusively without having to enable
.ignore
or.gitignore
files as well.If this is a bug, what are the steps to reproduce the behavior?
Run the following test case:
If this is a bug, what is the actual behavior?
The test case fails because the
foo
files are not ignored:If this is a bug, what is the expected behavior?
The test case succeeds.
Analysis
The cause for this behavior is the following function in
ignore/src/dir.rs
:.. which returns
false
if all of these are disabled. This, in turn, causesIgnore::matched
to skip ignore files alltogether:If the above behavior is actually intended, a simple bugfix would be to add the following:
The text was updated successfully, but these errors were encountered: