-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Display a warning when searching within an ignored directory #1404
Comments
This feature actually existed at one point. Unfortunately, it looks like it has evaporated, probably intentionally during a refactor. Getting this back in is a good idea. |
Hi, I'd like to try to implement this for #hacktoberfest. I understand the feature request, but does someone have a simple example I could use to test this feature? In addition, what's the layout of this codebase - where would this feature be implemented? |
Removing UI usage confusion is always a good thing. I am sure I'm preaching to the choir here, but I'd suggest either with by issuing warnings, or even better by POLA design. Following POLA, files and directories specified as arguments to For example, searching the working directory that has a
Narrowing this down to searching just the
Note that in this case it is very clear the Perhaps this approach is useful. Others have found it to be less confusing, especially when adding option |
@genivia-inc Sorry, but this is the ripgrep issue tracker, not ugrep's. ripgrep will search files that are explicitly given as arguments but would otherwise be ignored via |
@BurntSushi Your sarcasm is inappropriate. I am merely pointing to an alternative approach to report I agree that warnings are fine too. Just sharing my observation as potentially useful, as I stated in my closing argument. Whatever works best to deal with POLA problems and improving the overall UX is up to users to decide, which should be applauded. |
I wasn't being sarcastic. This isn't the place to unsolicitedly discuss tangentially related issues that are specific to some other tool. I'm going to mark further such comments from you as off topic. |
So I just tried this, and the behavior is slightly more subtle. With this .gitignore:
running If we add the glob to .gitignore:
Then So in the literal sense, @BurntSushi Does that seem like a reasonable idea? Would you say only in the everything-ignored case or in every case where there's an ignore on some files that were under consideration? |
That's the idea and it's how the original warning message worked. If ripgrep is invoked with no arguments and nothing is searched, then ripgrep should emit a warning. The particulars of git ignore rules are just motivating use cases. The existence of the warning message shouldn't need to care about git ignore rules specifically. |
Can you point me to a commit/place where this feature existed? Happy to try and bring it back. |
Lines 409 to 413 in 6799dcf
I think it got removed when I moved things over to libripgrep in 0.10.0. I can't remember why. |
Got it, I'll take a look. Thanks! |
This was once part of ripgrep, but at some point, was unintentionally removed. The value of this warning is that since ripgrep tries to be "smart" by default, it can be surprising if it doesn't search certain things. This warning covers the case when ripgrep searches *nothing*, which happens somewhat more frequently than you might expect. e.g., If you're searching within an ignore directory. Fixes #1404, Closes #1762
This was once part of ripgrep, but at some point, was unintentionally removed. The value of this warning is that since ripgrep tries to be "smart" by default, it can be surprising if it doesn't search certain things. This warning covers the case when ripgrep searches *nothing*, which happens somewhat more frequently than you might expect. e.g., If you're searching within an ignore directory. Note that for now, we only print this message when the user has not supplied any explicit paths. It's not clear that we want to print this otherwise, and in particular, it seems that the message shows up too eagerly. e.g., 'rg foo does-not-exist' will both print an error about 'does-not-exist' not existing, *and* the message about no files being searched, which seems annoying in this case. We can always refine this logic later. Fixes #1404, Closes #1762
This was once part of ripgrep, but at some point, was unintentionally removed. The value of this warning is that since ripgrep tries to be "smart" by default, it can be surprising if it doesn't search certain things. This warning covers the case when ripgrep searches *nothing*, which happens somewhat more frequently than you might expect. e.g., If you're searching within an ignore directory. Note that for now, we only print this message when the user has not supplied any explicit paths. It's not clear that we want to print this otherwise, and in particular, it seems that the message shows up too eagerly. e.g., 'rg foo does-not-exist' will both print an error about 'does-not-exist' not existing, *and* the message about no files being searched, which seems annoying in this case. We can always refine this logic later. Fixes #1404, Closes #1762
What version of ripgrep are you using?
How did you install ripgrep?
Cargo
What operating system are you using ripgrep on?
Ubuntu
Describe your question, feature request, or bug.
Sometimes you end up inside a directory that's actually gitignored, and search for stuff. Of course, no file will get searched, and you will be confused.
If ripgrep ends up not searching any files and it happens to be in a situation where there are files to search that it cannot because of the ignore file, it should probably display a warning saying "some files were skipped because of the ignore file, try
--no-ignore-vcs
to include".I don't know if ripgrep ever shows warnings, but this would be a nice place to do so.
The text was updated successfully, but these errors were encountered: