Skip to content
Myr

Add test for gitignore workaround

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

And make sure it works for user-supplied path of "." Also add changelog entry

authored by Thayne McCombs · committed by David Peter · parent 6af8f09 · Browse files · 3 files+18 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+18 added−0 removed

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

3 files+18 added−0 removed

modified:src/cli.rs+3 added
663 unmodified lines
664665 fn normalize_path(&self, path: &Path) -> PathBuf {666 if self.absolute_path {667 filesystem::absolute_path(path.normalize().unwrap().as_path()).unwrap()668 } else if path == Path::new(".") {669 // Change "." to "./" as a workaround for https://github.com/BurntSushi/ripgrep/pull/2711670 PathBuf::from("./")671 } else {672 path.to_path_buf()673 }674 }
202 unmodified lines
modified:tests/tests.rs+13 added
2597 unmodified lines
2598 other_dir/.git/foo12599 nested/dir/.git/foo2",2600 );2601}26022603#[test]2604fn test_gitignore_parent() {2605 let te = TestEnv::new(&["sub"], &[".abc", "sub/.abc"]);26062607 fs::File::create(te.test_root().join(".gitignore"))2608 .unwrap()2609 .write_all(b".abc\n")2610 .unwrap();26112612 te.assert_output_subdirectory("sub", &["--hidden"], "");2613 te.assert_output_subdirectory("sub", &["--hidden", "--search-path", "."], "");2614}
modified:CHANGELOG.md+2 added
10 unmodified lines
1112## Bugfixes1314- Respect NO_COLOR environment variable with `--list-details` option. (#1455)15- Fix bug that would cause hidden files to be includeddespite gitignore rules16 if search path is "." (#1461, BurntSushi/ripgrep#2711).171819## Changes20
736 unmodified lines