-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[ignore] Add API for adding glob patterns to ignore #2705
Comments
I personally don't think needing to add a With that said, I am hoping to do a refresh of the |
Here's my actual problem: In order to exclude the I still think this is a reasonable default to have (and maybe it would make sense for the ignore crate itself to do this?), but there are a few users who do want to include the What I really want is a way to add additional rules at the same level as the .gitignore file, at lower priority than the override rules. Or, having native support for .git would be cool too. :) I'm looking forward to seeing your redesign. |
After a bit of experimentation, implementing an |
That's not quite what's happening. The issue is one of whitelist/blacklist semantics. Namely, if all you have are blacklist rules, then a path passes the filter so long as it doesn't match anything in the blacklist. But if you have any whitelist rules, then a path passes the filter only when it both matches a rule and the last rule it matches is a whitelist rule. That applies when you have 0 or more blacklist rules. This is easier with examples (using this repo):
The second to last example is the interesting one. The issue is that there is one whitelist pattern, so the only thing ripgrep will search are things matching Perhaps this will help with your use case.
I don't think so. I find this to be surprising behavior personally. If I ask to see hidden files, I want to see all of them, unless I've explicitly configured it to do otherwise. For example, another approach here is |
Describe your feature request
In the
ignore
crate,WalkerBuilder::override
allows you to pass in overrides, which use ignore globs with the meaning of "!" inverted. For ripgreps-g
option that inversion make sense.In
fd
, there is an--exclude
option, which takes additional patterns to exclude. In order for that to work we use the override mechanism but currently prepend a "!" to the glob to counteract the inversion that overrides performs. It would be nice if there was an API that we could use to add an override to exclude instead of include a pattern directly.The text was updated successfully, but these errors were encountered: