Description
Please tick this box to confirm you have reviewed the above.
- I have a different issue.
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 10.42 is available (JIT is available)
How did you install ripgrep?
pacman
What operating system are you using ripgrep on?
archlinux
Describe your bug.
If you have an ignore rule like "/a/*/b" in .ignore or .gitignore, then it will ignore files it shouldn't if you are in a subdirectory that has a grandchild named b.
See also sharkdp/fd#1506
What are the steps to reproduce the behavior?
Create a directory with a layout like:
.
└── a
├── c
│ └── b
│ └── foo
└── src
└── f
└── b
└── foo
7 directories, 2 files
and at the top level create a .ignore file with the folowing contents:
/a/*/b
From the root run rg --files
then run rg --files
from the a/src directory (either cd into that directory or supply it as the path)
What is the actual behavior?
When run from the root folder, it works as expected and finds a/src/f/b/foo but not a/c/b/foo (because *
only matches a single directory).
However, if I run from a/src
then it doesn't find any files.
Possibly related, if I run rg --files
from the a/
folder, then it actually finds both foo files, even though a/c/b/foo should be excluded because of it's relation to the folder containing the .ignore file (and the ignore pattern is absolute).
What is the expected behavior?
a/src/f/b/foo should not be ignored, regardless of which directory I run rg
from.
a/c/b/foo should be ignored, regardless of which directory I run rg
from.