mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-01 20:52:03 -07:00
ignore: fix custom ignore name bug
This commit fixes a bug in the handling of custom gitignore file names. Previously, the directory walker would check for whether there were any ignore rules present, but this check didn't incorporate the custom gitignore rules. At a high level, this permits custom gitignore names to be used even if no other source of gitignore rules is used. Fixes #800
This commit is contained in:
committed by
Andrew Gallant
parent
5c1af3c25d
commit
b71a110ccf
@@ -1585,6 +1585,26 @@ mod tests {
|
||||
assert_paths(td.path(), &builder, &["bar", "a", "a/bar"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn custom_ignore_exclusive_use() {
|
||||
let td = TempDir::new("walk-test-").unwrap();
|
||||
let custom_ignore = ".customignore";
|
||||
mkdirp(td.path().join("a"));
|
||||
wfile(td.path().join(custom_ignore), "foo");
|
||||
wfile(td.path().join("foo"), "");
|
||||
wfile(td.path().join("a/foo"), "");
|
||||
wfile(td.path().join("bar"), "");
|
||||
wfile(td.path().join("a/bar"), "");
|
||||
|
||||
let mut builder = WalkBuilder::new(td.path());
|
||||
builder.ignore(false);
|
||||
builder.git_ignore(false);
|
||||
builder.git_global(false);
|
||||
builder.git_exclude(false);
|
||||
builder.add_custom_ignore_filename(&custom_ignore);
|
||||
assert_paths(td.path(), &builder, &["bar", "a", "a/bar"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gitignore() {
|
||||
let td = TempDir::new("walk-test-").unwrap();
|
||||
|
Reference in New Issue
Block a user