summaryrefslogtreecommitdiffstats
path: root/src/app.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-08-25 21:08:42 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-08-26 18:42:25 -0400
commitf9ce7a84a8ce1be033099ee4785815bc5f269223 (patch)
tree9197345c31f06b2f1757c758b307b2f7372b7708 /src/app.rs
parent1b6089674e38aa0fde9810b4d25d79119f1c2400 (diff)
ignore: add 'same_file_system' option
This commit adds a 'same_file_system' option to the walk builder. For single threaded walking, it defers to the walkdir crate, which has the same option. The bulk of this commit implements this flag for the parallel walker. We add one very feeble test for this. The parallel walker is now officially a complete mess. Closes #321
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/app.rs b/src/app.rs
index 35009fca..1394f9d2 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -586,6 +586,7 @@ pub fn all_args_and_flags() -> Vec<RGArg> {
flag_no_pcre2_unicode(&mut args);
flag_null(&mut args);
flag_null_data(&mut args);
+ flag_one_file_system(&mut args);
flag_only_matching(&mut args);
flag_path_separator(&mut args);
flag_passthru(&mut args);
@@ -1647,6 +1648,33 @@ Using this flag implies -a/--text.
args.push(arg);
}
+fn flag_one_file_system(args: &mut Vec<RGArg>) {
+ const SHORT: &str =
+ "Do not descend into directories on other file systems.";
+ const LONG: &str = long!("\
+When enabled, ripgrep will not cross file system boundaries relative to where
+the search started from.
+
+Note that this applies to each path argument given to ripgrep. For example, in
+the command 'rg --one-file-system /foo/bar /quux/baz', ripgrep will search both
+'/foo/bar' and '/quux/baz' even if they are on different file systems, but will
+not cross a file system boundary when traversing each path's directory tree.
+
+This is similar to find's '-xdev' or '-mount' flag.
+
+This flag can be disabled with --no-one-file-system.
+");
+ let arg = RGArg::switch("one-file-system")
+ .help(SHORT).long_help(LONG)
+ .overrides("no-one-file-system");
+ args.push(arg);
+
+ let arg = RGArg::switch("no-one-file-system")
+ .hidden()
+ .overrides("one-file-system");
+ args.push(arg);
+}
+
fn flag_only_matching(args: &mut Vec<RGArg>) {
const SHORT: &str = "Print only matches parts of a line.";
const LONG: &str = long!("\