mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 12:12:00 -07:00
Fix bug when processing parent gitignore files.
This particular bug was triggered whenever a search was run in a directory with a parent directory that contains a relevant .gitignore file. In particular, before matching against a parent directory's gitignore rules, a path's leading `./` was not stripped, which results in errant matching. We now make sure `./` is stripped. Fixes #184.
This commit is contained in:
@@ -837,6 +837,20 @@ clean!(
|
||||
assert_eq!(lines, TESTCASE);
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/184
|
||||
clean!(regression_184, "test", ".", |wd: WorkDir, mut cmd: Command| {
|
||||
wd.create(".gitignore", ".*");
|
||||
wd.create_dir("foo/bar");
|
||||
wd.create("foo/bar/baz", "test");
|
||||
|
||||
let lines: String = wd.stdout(&mut cmd);
|
||||
assert_eq!(lines, format!("{}:test\n", path("foo/bar/baz")));
|
||||
|
||||
cmd.current_dir(wd.path().join("./foo/bar"));
|
||||
let lines: String = wd.stdout(&mut cmd);
|
||||
assert_eq!(lines, "baz:test\n");
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/20
|
||||
sherlock!(feature_20_no_filename, "Sherlock", ".",
|
||||
|wd: WorkDir, mut cmd: Command| {
|
||||
|
Reference in New Issue
Block a user