diff options
-rw-r--r-- | ignore/src/gitignore.rs | 4 | ||||
-rw-r--r-- | tests/regression.rs | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ignore/src/gitignore.rs b/ignore/src/gitignore.rs index 1a44e626..48d1bb4b 100644 --- a/ignore/src/gitignore.rs +++ b/ignore/src/gitignore.rs @@ -69,8 +69,7 @@ impl Glob { /// Returns true if and only if this glob has a `**/` prefix. fn has_doublestar_prefix(&self) -> bool { - self.actual.starts_with("**/") - || (self.actual == "**" && self.is_only_dir) + self.actual.starts_with("**/") || self.actual == "**" } } @@ -710,6 +709,7 @@ mod tests { ignored!(ig40, ROOT, "\\*", "*"); ignored!(ig41, ROOT, "\\a", "a"); ignored!(ig42, ROOT, "s*.rs", "sfoo.rs"); + ignored!(ig43, ROOT, "**", "foo.rs"); not_ignored!(ignot1, ROOT, "amonths", "months"); not_ignored!(ignot2, ROOT, "monthsa", "months"); diff --git a/tests/regression.rs b/tests/regression.rs index 8102fd90..e4da2f1c 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -596,3 +596,11 @@ rgtest!(r1164, |dir: Dir, mut cmd: TestCommand| { cmd.arg("--no-ignore-file-case-insensitive").stdout() ); }); + +// See: https://github.com/BurntSushi/ripgrep/issues/1173 +rgtest!(r1173, |dir: Dir, mut cmd: TestCommand| { + dir.create_dir(".git"); + dir.create(".gitignore", "**"); + dir.create("foo", "test"); + cmd.arg("test").assert_err(); +}); |