Skip to content
Myr

Add same file system functionality

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

This adds a `--same-file-system` CLI option that instructs the walker to not cross file system boundaries. Due to the fact that the corresponding option of the `ignore` crate's `WalkBuilder` does not support platforms other than Unix and Windows, the option does nothing on platforms other than those. Resolves #507

authored by Simon Engmann · committed by David Peter · parent 0f27485 · Browse files · 5 files+26 added−13 removed
This commit

State

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

Diff stats

5 files+26 added−13 removed

  • other:+26 added−13 removed

5 files+26 added−13 removed

modified:src/internal/opts.rs+3 added
26 unmodified lines
2728 /// Whether to follow symlinks or not.29 pub follow_links: bool,3031 /// Whether to limit the search to starting file system or not.32 pub same_file_system: bool,3334 /// Whether elements of output should be separated by a null character35 pub null_separator: bool,3637 /// The maximum search depth, or `None` if no maximum search depth should be set.
47 unmodified lines
modified:src/app.rs+6 added
113 unmodified lines
114 .short("L")115 .alias("dereference")116 .overrides_with("follow"),117 )118 .arg(arg("same-file-system").long("same-file-system"))119 .arg(120 arg("full-path")121 .long("full-path")122 .short("p")
206 unmodified lines
329 doc!(h, "follow"330 , "Follow symbolic links"331 , "By default, fd does not descend into symlinked directories. Using this flag, symbolic \332 links are also traversed.");333 doc!(h, "same-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.");338 doc!(h, "full-path"339 , "Search full path (default: file-/dirname only)"340 , "By default, the search pattern is only matched against the filename (or directory \341 name). Using this flag, the pattern is matched against the full path.");
126 unmodified lines
modified:src/main.rs+1 added
206 unmodified lines
207 read_vcsignore: !(matches.is_present("no-ignore")208 || matches.is_present("rg-alias-hidden-ignore")209 || matches.is_present("no-ignore-vcs")),210 follow_links: matches.is_present("follow"),211 same_file_system: matches.is_present("same-file-system"),212 null_separator: matches.is_present("null_separator"),213 max_depth: matches214 .value_of("depth")215 .or_else(|| matches.value_of("rg-depth"))
86 unmodified lines
modified:src/walk.rs+2 added
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.same_file_system && (cfg!(unix) || cfg!(windows)))83 .max_depth(config.max_depth);8485 if config.read_fdignore {86 walker.add_custom_ignore_filename(".fdignore");
302 unmodified lines
modified:README.md+14 added-13 removed
283 unmodified lines
284USAGE:285 fd [FLAGS/OPTIONS] [<pattern>] [<path>...]286287FLAGS:288 -H, --hidden Search hidden files and directories289 -I, --no-ignore Do not respect .(git|fd)ignore files290 --no-ignore-vcs Do not respect .gitignore files291 -s, --case-sensitive Case-sensitive search (default: smart case)292 -i, --ignore-case Case-insensitive search (default: smart case)293 -g, --glob Glob-based search (default: regular expression)294 -F, --fixed-strings Treat the pattern as a literal string295 -a, --absolute-path Show absolute instead of relative paths296 -L, --follow Follow symbolic links297 -p, --full-path Search full path (default: file-/dirname only)298 -0, --print0 Separate results by the null character299 -h, --help Prints help information300 -V, --version Prints version information288 -H, --hidden Search hidden files and directories289 -I, --no-ignore Do not respect .(git|fd)ignore files290 --no-ignore-vcs Do not respect .gitignore files291 -s, --case-sensitive Case-sensitive search (default: smart case)292 -i, --ignore-case Case-insensitive search (default: smart case)293 -g, --glob Glob-based search (default: regular expression)294 -F, --fixed-strings Treat the pattern as a literal string295 -a, --absolute-path Show absolute instead of relative paths296 -L, --follow Follow symbolic links297 --same-file-system Don't cross file system boundaries (only Unix/Windows)298 -p, --full-path Search full path (default: file-/dirname only)299 -0, --print0 Separate results by the null character300 -h, --help Prints help information301 -V, --version Prints version information302303OPTIONS:304 -d, --max-depth <depth> Set maximum search depth (default: none)305 -t, --type <filetype>... Filter by type: file (f), directory (d), symlink (l),
242 unmodified lines