mirror of
https://github.com/sharkdp/fd.git
synced 2026-10-12 02:22:28 +00:00
Treat single dash as search path
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
## Bugfixes
|
||||
- Handle invalid working directories gracefully when using `--full-path`, see #1900 (@Xavrir).
|
||||
- Fire the "search pattern contains a path separator" diagnostic for any pattern containing `/`, not just patterns that happen to name an existing directory. Preserves the legacy Windows behaviour that also flags native `\` separators when the pattern resolves to a real directory. See #1873.
|
||||
- Treat `-` as a literal search path when a directory with that name exists, see #849 (@Sean-Kenneth-Doherty).
|
||||
|
||||
# 10.4.2
|
||||
|
||||
|
||||
@@ -712,6 +712,10 @@ impl Opts {
|
||||
} else if path == Path::new(".") {
|
||||
// Change "." to "./" as a workaround for https://github.com/BurntSushi/ripgrep/pull/2711
|
||||
PathBuf::from("./")
|
||||
} else if path == Path::new("-") {
|
||||
// Prefix "-" so the underlying walker treats it as a path.
|
||||
// See sharkdp/fd#849.
|
||||
Path::new(".").join(path)
|
||||
} else {
|
||||
path.to_path_buf()
|
||||
}
|
||||
|
||||
@@ -459,6 +459,13 @@ fn test_explicit_root_path() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_dash_root_path() {
|
||||
let te = TestEnv::new(&["-"], &["-/foo"]);
|
||||
|
||||
te.assert_output(&[".", "-"], "./-/foo");
|
||||
}
|
||||
|
||||
/// Regex searches
|
||||
#[test]
|
||||
fn test_regex_searches() {
|
||||
|
||||
Reference in New Issue
Block a user