ggreer / the_silver_searcher

A code-searching tool similar to ack, but faster.

Home Page:http://geoff.greer.fm/ag/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ignore patterns should not directory below their source file

arenevier opened this issue · comments

If I folder contains a .gitignore file with a pattern of the same name as the folder, ag will not find anything when searching that directory from the parent.

Here are instructions to reproduce the issue:

mkdir -p myprogram
cd myprogram

# Lets assume this project will later build a binary called by program. Put it in .gitignore
echo myprogram > .gitignore

# now, start writing the source
echo "print 'hello world'" > main.py

cd ../
# now, search for a string in that directory
ag hello myprogram

Nothing is found

ag -D hello myprogram will show

DEBUG: file myprogram/main.py ignored because path somewhere matches name myprogram

This seems wrong since the ignore directive is defined in myprogram/.gitignore. So it should not apply to directory names below that definition.