Skip to content

root-level files in .ignore file not excluded #2250

Answered by BurntSushi
victoriastuart asked this question in Q&A
Discussion options

You must be logged in to vote

Your search command, rg * --ignore-file .ignore -in -e 'ohC8Ohfi', is telling ripgrep to explicitly search the apple file. So no, ripgrep isn't going to ignore it and that's by design.

rg * might not look explicit to you, but ripgrep doesn't see that *. That * is expanded by your shell before invoking ripgrep. So your actual search looks like rg apple --ignore-file .ignore -in -e 'ohC80hfi'. You can pretty clearly see this by looking at ripgrep's argv via the --debug output:

$ echo '/apple' > .ignore
$ echo test > apple
$ rg test
No files were searched, which means ripgrep probably applied a filter you didn't expect.
Running with --debug will show why files are being skipped.
[agallant@ag…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by victoriastuart
Comment options

You must be logged in to vote
5 replies
@BurntSushi
Comment options

@victoriastuart
Comment options

@BurntSushi
Comment options

@victoriastuart
Comment options

@BurntSushi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants