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
Negative .gitignore pattern seem to be ignored #778
Comments
@rnestler Thanks for the bug report! Unfortunately this report is a little confused in that your posted
Notice that The reason why this bug exists is because |
Oh I'm so sorry about that. I tried to create a minimal working example and screwed up 🤦
According to my understanding of the debug output ripgrep changes the pattern to
But the ripgrep still interprets the .gitignore pattern differently than git doesn't it? I mean given:
When I remove the white-list pattern So is this still a wont-fix or could this actually be solved? If it provides any value I could open a new issue. But I totally understand that converting the .gitignore globs to regexes is a brittle thing where it's almost impossible to get all edge-cases right. So I'm perfectly fine with just adjusting my .gitignore patterns 😊 Also thanks a lot for creating and maintaining ripgrep! |
Indeed! When
Again, there is an impedance mismatch here. That's because
Just to clarify here, converting globs to regexes is an implementation detail, and that is certainly not the problem here. The conversion process is sound. The problem here are the semantics. Basically, if you come up with a consistent rule that ripgrep can use here to produce the same behavior as git, then I'm all ears. I can't immediately see one, but perhaps a different perspective is what's needed. Certainly, a simple rule like " Note, if you want to brainstorm here, I strongly urge you to internalize the contents of |
Ok so I untracked everything in buildtool and it will still show up because it is not ignored. But of course that means
Will do that! And also run some more experimentation and dig a bit into the ripgrep source code. I already feel a bit bad for consuming your time 😉 |
The output of
You shouldn't. So long as we're being productive and moving toward a resolution, then I'm very happy to participate. :) |
I just noticed that this seems now fixed:
Noticed while trying to explain to somebody why it's important to not have recursive patterns by accident in |
What version of ripgrep are you using?
What operating system are you using ripgrep on?
Linux 4.13.0-31-generic #34~16.04.1-Ubuntu SMP Fri Jan 19 17:11:01 UTC 2018 x86_64 x86_64 GNU/Linux
Describe your question, feature request, or bug.
riggrep seems to interpret negative patterns (starting with
!
) in .gitignore differently than gitIf this is a bug, what are the steps to reproduce the behavior?
Given the following git repository:
with this
.gitignore
file:If this is a bug, what is the actual behavior?
rg can't match stuff in buildtools. git grep is perfectly fine with it:
Debug output: https://gist.github.com/rnestler/f58d58b8350009e228cb1a0210f1b4d8
If this is a bug, what is the expected behavior?
Return the same results as
git grep
The text was updated successfully, but these errors were encountered: