-
-
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
Negation pattern/whitelisting is ignored from --ignore-file
#2777
Comments
This is correct behavior. From the man page:
In other words, The docs for
This should be rephrased to say that they have lower precedence than rules from other ignore files. |
OK, make sense. Is there a way to provide a global override file so ? Main use case: I have some personal files which I ignore globally using a global git ignore (let's say Ideally, to make everyone happy, there should be both:
If there is no such possibility, would you accept a pull-request adding it (it might take time, I'm no rust expert, still learning) ? |
Sure, you could create a Otherwise, no, I'm not accepting any major changes to how ignore rules work in ripgrep right now. Not until the system has been re-thought and probably redesigned. |
Too bad, one I'll wait for the redesign. Thanks for the quick and precise answers ! |
You don't need to put a |
Oh, that will do it !! Thanks for the tip, I wasn't aware that parent files are processed ! 🙏🏼
Hard to answer. This has been a long journey (not) finding this right info: The
Then I found the User Guide dedicated section referenced in the README, but it only talks about git specific ignore files (including only globals from So I read comments from all the PRs on the topics trying to find data and one was saying that only the current repository I wasn't even aware that there is a So clearly a documentation issue and I might submit PR clarifying that between the readme, the help, the user guide and the manpage. Would you accept such pull request ? |
Ah yeah, sorry, I was referencing my prior comment where I suggested Otherwise I agree that the whole UX around ignore rules is sub-optimal. There are also legitimate bugs with its implementation. So it's all a bit of a mess unfortunately, but mostly works. |
Yes I'd be happy to try and work with you on that. Thank you! |
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ripgrep 14.1.0
features:-simd-accel,-pcre2
simd(compile):+SSE2,-SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2
PCRE2 is not available in this build of ripgrep.
How did you install ripgrep?
Pacman
What operating system are you using ripgrep on?
Archlinux
Describe your bug.
Negation patterns are ignored from
--ignore-file
while documentation says it should take precedenceWhat are the steps to reproduce the behavior?
mkdir case && cd case && git init
)touch .hidden
.hidden
to the.gitignore
filesearch.ignore
file whitelisting the.hidden
file:!.hidden
rg --files --hidden --ignore-file=search.ignore
What is the actual behavior?
.hidden
file is not whitelisted and is missing from result while it should be there.Here the actual output with
rg --files --hidden --ignore-file=search.ignore --debug
:What is the expected behavior?
Ignore provided with
--ignore-file
should take precedence and whitelist previously ignored patterns.Here's the expected output:
Note
Adding the same negation pattern to the
.ignore
file works as expected and whitelist.hidden
:Given standard ignore patterns are properly handled from
--ignore-file
, it means that only--ignore-file
negation patterns are brokenThe text was updated successfully, but these errors were encountered: