Skip to content

Best practice to search for file names recursively respecting .gitignore? #1589

Answered by BurntSushi
rolfb asked this question in General
Discussion options

You must be logged in to vote

You cannot cause explicit positional parameters like you've provided to be ignored by .gitignore. This is an intentional design decision. In particular, ripgrep does not see **/index.js. It sees the expansion of **/index.js to every individual matching file by your shell. Therefore, ripgrep cannot differentiate between rg foo/index.js and rg **/index.js. They are literally exactly the same. Thus, if someone ran rg foo/index.js and foo/index.js was in their .ignore and ripgrep respected ignore files for positional parameters, then rg foo/index.js would not search anything. This would be highly unexpected, but does unfortunately lead to these sorts of cases where you want that ignore filter…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rolfb
Comment options

Answer selected by rolfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants