Skip to content
Myr

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

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

Treat single dash as a literal search path

authored by Thayne McCombs · committed by GitHub · parents 1cfac9f, f1dd935 · Browse files · 3 files+12 added−0 removed
This commit

State

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

Diff stats

3 files+12 added−0 removed

  • tests:+7 added−0 removed
  • other:+5 added−0 removed

3 files+12 added−0 removed

modified:src/cli.rs+4 added
710 unmodified lines
711 filesystem::absolute_path(path.normalize().unwrap().as_path()).unwrap()712 } else if path == Path::new(".") {713 // Change "." to "./" as a workaround for https://github.com/BurntSushi/ripgrep/pull/2711714 PathBuf::from("./")715 } else if path == Path::new("-") {716 // Prefix "-" so the underlying walker treats it as a path.717 // See sharkdp/fd#849.718 Path::new(".").join(path)719 } else {720 path.to_path_buf()721 }722 }
235 unmodified lines
modified:tests/tests.rs+7 added
457 unmodified lines
458 ../three/directory_foo/",459 );460}461462#[test]463fn test_single_dash_root_path() {464 let te = TestEnv::new(&["-"], &["-/foo"]);465466 te.assert_output(&[".", "-"], "./-/foo");467}468469/// Regex searches470#[test]471fn test_regex_searches() {472 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
2338 unmodified lines
modified:CHANGELOG.md+1 added
4 unmodified lines
56## Bugfixes7- Handle invalid working directories gracefully when using `--full-path`, see #1900 (@Xavrir).8- 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.9- Fix bug where passing "-" as a directory argument didn't actually search that directory, see #849 (@Sean-Kenneth-Doherty).1011# 10.4.21213## Bugfixes
848 unmodified lines