Merge pull request #2006 from Sean-Kenneth-Doherty/codex/single-dash-search-path

Treat single dash as a literal search path
This commit is contained in:
Thayne McCombs authored and GitHub committed 2026-05-17 12:32:09 -06:00
commit d491003759
3 files changed
+12

No files matched your search

+1
View File
@@ -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.
- Fix bug where passing "-" as a directory argument didn't actually search that directory, see #849 (@Sean-Kenneth-Doherty).
# 10.4.2
+4
View File
@@ -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()
}
+7
View File
@@ -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() {