Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Entries in .gitignore are applied to the wrong base directory #1536

Open
rtpt-alexanderneumann opened this issue Feb 27, 2024 · 1 comment
Open

Comments

@rtpt-alexanderneumann
Copy link

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!

@cielavenir
Copy link

Seems I found the same issue described in https://github.com/cielavenir/silversearcher-parent-directory-ignored

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

No branches or pull requests

2 participants