the_silver_searcher
the_silver_searcher copied to clipboard
.gitignore directory matching discrepancies
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