Entries in .gitignore are applied to the wrong base directory
rtpt-alexanderneumann opened this issue · comments
Thank you very much for ag
!
I have an issue similar to #1318:
Reproduction instructions:
mkdir root
cd root
echo 'root/subdir' > .gitignore
mkdir subdir
echo 'string to look for: shibboleth' > subdir/test.txt
Situation: I can find the string shibboleth
with ag
if I run ag
in the current directory:
$ tree
.
└── subdir
└── test.txt
2 directories, 1 file
$ ag shibboleth .
subdir/test.txt
1:string to look for: shibboleth
But when I search for it in the same directory specified as ../root
, then it does not find the string:
$ ag shibboleth ../root
[1] 93249 exit 1 ag shibboleth ../root
But it should have found the string.
I suspect that the entries in .gitignore
are applied relative to the "base directory" that is given to ag
as the parameter. The entry root/subdir
does not match any files/dirs within the root
directory, but it seems that ag
is using it relative to the "base directory", so searching within ../root
makes ag
construct the path ../root/subdir
and ignores it.
It's really odd!
Is there anything else I can help with to get this issue solved? Thanks a lot!