Skip to content
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

incorrect gitignore behaviour #649

Closed
Kartiku opened this issue Oct 23, 2017 · 2 comments · Fixed by #652
Closed

incorrect gitignore behaviour #649

Kartiku opened this issue Oct 23, 2017 · 2 comments · Fixed by #652

Comments

@Kartiku
Copy link

Kartiku commented Oct 23, 2017

Steps

  1. Clone nim project git clone https://github.com/nim-lang/Nim.git
  2. In nim folder run rg uint64. It gives no results which is incorrect. Silver searcher gives correct results
  3. Used git check-ignore lib\system.nim to verify git doesn't ignore the file
  4. rg --debug output here. Lib folder is being ignored

Using 0.7.1 release from here

@lambda
Copy link
Contributor

lambda commented Oct 24, 2017

That is a strange .gitignore. Ignoring everything with * then unignoring all directories with !**/, and all files with extensions with !*.*, and finally listing a bunch of more specific ignore rules.

Anyhow, regardless of how strange a gitignore it is, looks like the issue is with the conversion of !**/ into **/**/* before converting it into a regex. That looks like a clear bug.

lambda added a commit to lambda/ripgrep that referenced this issue Oct 24, 2017
When processing a rule that ends in a slash, we strip it off and set the
`is_only_dir` flag.  We then apply the rule that paths that aren't
absolute should be given an implicit `**/` prefix, while avoiding
adding that prefix if it already exists.

However, this means that we miss the case in which we had already
stripped off the trailing slash and set `is_only_dir`.  Correct this
by also explicitly checking for that case.

Fixes BurntSushi#649
@lambda
Copy link
Contributor

lambda commented Oct 24, 2017

This should be fixed by PR #652, but that's currently held up by an odd, seemingly unrelated test failure on the Mac build. Should be merged once we've sorted that out.

BurntSushi pushed a commit that referenced this issue Nov 1, 2017
When processing a rule that ends in a slash, we strip it off and set the
`is_only_dir` flag.  We then apply the rule that paths that aren't
absolute should be given an implicit `**/` prefix, while avoiding
adding that prefix if it already exists.

However, this means that we miss the case in which we had already
stripped off the trailing slash and set `is_only_dir`.  Correct this
by also explicitly checking for that case.

Fixes #649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants