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

.gitignore directory matching discrepancies

jtuckerk opened this issue · comments

I am seeing that git and ag have different ignore logic.

as a minimal example within a repo structured like so:

a_repo
├── .gitignore
├── config_dir
│   └── personal_config.txt
└── sub_dir
    └── config_dir
        └── code_to_track.py

We want to ignore all files in a_repo/config_dir by having a .gitignore file like:

config_dir/

git works as expected ignoring the personal_config.txt, while tracking changes in code_to_track.py, however ag incorrectly decides to ignore any directory like config_dir so I am not receiving results from code_to_track.py

Ag is amazing and I'll try to contribute a fix if I can figure it out!

This .gitignore excludes config_dir/ on all levels.
And code_to_track.py is only tracked if it is explicitly added.

Use /config_dir/ to exclude the first one only.

https://www.atlassian.com/git/tutorials/saving-changes/gitignore#git-ignore-patterns