Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inverse of --files to show what files are skipped #2029

Closed
zachriggle opened this issue Oct 21, 2021 · 1 comment
Closed

Inverse of --files to show what files are skipped #2029

zachriggle opened this issue Oct 21, 2021 · 1 comment
Labels
wontfix A feature or bug that is unlikely to be implemented or fixed.

Comments

@zachriggle
Copy link

I feel like I might have already filed this, and hopefully there's a mechanism already built, but...

Using --files to see what is searched is great. The output can be compared with e.g. find . -type f but that's quite slow.

Is there a --ignored-files or similar flag that shows which files / directories that RipGrep encountered but did NOT search?

If not, this would be nice to have. One possible caveat is that RipGrep will not descend into ignored directories -- and sometimes it's nice to have a full listing of FILES that were ignored, not simply "we ignored everything under this directory".

@BurntSushi
Copy link
Owner

Is there a --ignored-files or similar flag that shows which files / directories that RipGrep encountered but did NOT search?

No.

One possible caveat is that RipGrep will not descend into ignored directories

This caveat is why adding this feature is difficult. I didn't build the filtering logic so that it could be inverted, because ripgrep only cares about what it does search, not what it doesn't search.

Now the --debug flag will show everything that ripgrep skips, but of course ripgrep does not descend into directories that it skips, so it isn't guaranteed to show every file that it ignored. It's only guaranteed to show one of its ancestors up to the starting path.

The output can be compared with e.g. find . -type f but that's quite slow.

I think this is an acceptable work-around for an uncommon task. "Quite slow" is probably only relevant in very large repos:

$ comm -23 <(find ./ -type f | sort) <(rg --files ./ | sort)

@BurntSushi BurntSushi added the wontfix A feature or bug that is unlikely to be implemented or fixed. label Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix A feature or bug that is unlikely to be implemented or fixed.
Projects
None yet
Development

No branches or pull requests

2 participants