-
-
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
.gitignore rule is matched incorrectly while in a subdir #2778
Comments
I just was pretty confused about the ignore behaviour of ripgrep and I think I observed the same problem described here. Minimal repro I could come up with: mkdir .git
echo '/folder/file' > .gitignore
mkdir -p folder/sub/folder/sub
echo 'do NOT find me' > folder/file
echo 'find me' > folder/sub/file
I expected the second call to rg to also find the file in the subdirectory. Perhaps the most notable difference to the original issue description is: You don't actually need to cd into the subdirectory to trigger the error, it is enough to pass the folder as argument to rg. Thanks in advance, I really appreciate your work on rg and your comments and writeups on it and other topics! |
I encountered a similar problem with ignore behavior.
I expect the second rg invocation to also ignore the b/c subdirectory. |
same here |
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ripgrep 14.1.0
How did you install ripgrep?
cargo install
What operating system are you using ripgrep on?
Linux
Describe your bug.
.gitignore rule to ignore
/dir/*.ext
works correctly when running rg from the repo root, but incorrectly ignores*.ext
in all subdirs when running fromdir
.What are the steps to reproduce the behavior? / What is the actual behavior?
while in git repo root dir (/tmp/repro), everything is working as expected:
but once you
cd
into./parent
, suddenly the rule is unexpectedly applied to the file insubdir
, too, and nothing is found:Debug output (argument parsing omitted: "no extra arguments found from configuration file", "heuristic chose to search ./"):
What is the expected behavior?
The text was updated successfully, but these errors were encountered: