summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-09-20 20:25:24 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-09-20 20:25:24 -0400
commit69095cf5c370b378261ca0470b3f030ddcbb7186 (patch)
treea681bc8e5a10fd19d00ca70a35b1f5341453f164 /src
parent7402db7b43191c84b47c532b24c831e64b4c212c (diff)
Add an error message for catching a common failure mode.
If you're in a directory that has a parent .gitignore (like, your $HOME), then it can cause ripgrep to simply not do anything depending on your ignore rules. There are probably other scenarios where ripgrep applies some filter that an end user doesn't expect, so try to catch the worst case (when ripgrep doesn't search anything).
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 936e4965..e4f4b4f3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -118,15 +118,23 @@ fn run(args: Args) -> Result<u64> {
}
workq
};
+ let mut paths_searched: u64 = 0;
for p in paths {
if p == Path::new("-") {
- workq.push(Work::Stdin)
+ paths_searched += 1;
+ workq.push(Work::Stdin);
} else {
for ent in try!(args.walker(p)) {
+ paths_searched += 1;
workq.push(Work::File(ent));
}
}
}
+ if !paths.is_empty() && paths_searched == 0 {
+ eprintln!("No files were searched, which means ripgrep probably \
+ applied a filter you didn't expect. \
+ Try running again with --debug.");
+ }
for _ in 0..workers.len() {
workq.push(Work::Quit);
}