How to get ag to find matches in node_modules?

I use ag to search the git repository. It does not find matches under my subdirectory node_modules . Why not, and how can I control this behavior?

+5
source share
1 answer

It turns out that ag saves the contents of the .gitignore file by .gitignore . Therefore, if node_modules is in .gitignore , ag will not look for it. This is all reasonable behavior, but hard to debug if you don't expect it. Hope this post helps.

At the end of man ag there is a good summary:

 IGNORING FILES By default, ag will ignore files whose names match patterns in .gitig- nore, .hgignore, or .agignore. These files can be anywhere in the directories being searched. Ag also ignores files matched by the svn:ignore property if svn --version is 1.6 or older. Finally, ag looks in $HOME/.agignore for ignore patterns. Binary files are ignored by default as well. If you want to ignore .gitignore, .hgignore, and svn:ignore, but still take .agignore into account, use -U. Use the -t option to search all text files; -a to search all files; and -u to search all, including hidden files. 

For my purposes, ag -t seems to work well.

+5
source

Source: https://habr.com/ru/post/1232314/


All Articles