Skip to content
Myr

Restrict `--one-file-system` to supported systems

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Instead of having the option do nothing at runtime on unsupported platforms, it is now only available on the systems that support it in the first place.

authored by Simon Engmann · committed by David Peter · parent 94993ca · Browse files · 2 files+22 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+22 added−10 removed

  • other:+22 added−10 removed

2 files+22 added−10 removed

modified:src/app.rs+20 added-8 removed
35 unmodified lines
36 .help(helps[name].short)37 .long_help(helps[name].long)38 };3940 App::new("fd")40 let app = App::new("fd")41 .version(crate_version!())42 .usage("fd [FLAGS/OPTIONS] [<pattern>] [<path>...]")43 .setting(AppSettings::ColoredHelp)44 .setting(AppSettings::DeriveDisplayOrder)
69 unmodified lines
114 .short("L")115 .alias("dereference")116 .overrides_with("follow"),117 )118 .arg(arg("one-file-system").long("one-file-system"))118 .arg(119 arg("full-path")120 .long("full-path")121 .short("p")
159 unmodified lines
281 .conflicts_with("path")282 .multiple(true)283 .hidden_short_help(true)284 .number_of_values(1),286 )285 );286287 // Make `--one-file-system` available only on Unix and Windows platforms, as per the288 // restrictions on the corresponding option in the `ignore` crate.289 // It's not pretty, but I'm unaware of a way to make just part of a builder chain conditional290 if cfg!(unix) || cfg!(windows) {291 app.arg(arg("one-file-system").long("one-file-system"))292 } else {293 app294 }295}296297#[rustfmt::skip]298fn usage() -> HashMap<&'static str, Help> {
38 unmodified lines
337 doc!(h, "follow"338 , "Follow symbolic links"339 , "By default, fd does not descend into symlinked directories. Using this flag, symbolic \340 links are also traversed.");333 doc!(h, "one-file-system"334 , "Don't cross file system boundaries (only Unix/Windows)"335 , "By default, fd will traverse the file system tree as far as other options dictate. \336 With this flag, fd ensures that it does not descend into a different file system than \337 the one it started in. Does nothing if not on Unix or Windows.");341 doc!(h, "full-path"342 , "Search full path (default: file-/dirname only)"343 , "By default, the search pattern is only matched against the filename (or directory \344 name). Using this flag, the pattern is matched against the full path.");
120 unmodified lines
465 , "Change the current working directory of fd to the provided path. The means that search \466 results will be shown with respect to the given base path. Note that relative paths \467 which are passed to fd via the positional <path> argument or the '--search-path' option \468 will also be resolved relative to this directory.");469470 if cfg!(unix) || cfg!(windows) {471 doc!(h, "one-file-system"472 , "Don't cross file system boundaries"473 , "By default, fd will traverse the file system tree as far as other options dictate. \474 With this flag, fd ensures that it does not descend into a different file system \475 than the one it started in.");476 }477478 h479}
modified:src/walk.rs+2 added-2 removed
76 unmodified lines
77 .git_global(config.read_vcsignore)78 .git_exclude(config.read_vcsignore)79 .overrides(overrides)80 .follow_links(config.follow_links)81 // Same file system is only supported on Unix and Windows platforms82 .same_file_system(config.one_file_system && (cfg!(unix) || cfg!(windows)))81 // No need to check for supported platforms, option is unavailable on unsupported ones82 .same_file_system(config.one_file_system)83 .max_depth(config.max_depth);8485 if config.read_fdignore {86 walker.add_custom_ignore_filename(".fdignore");
302 unmodified lines