mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-25 17:21:57 -07:00
globset: fix repeated use of **
This fixes a bug where repeated use of ** didn't behave as it should. In particular, each use of `**` added a new requirement directory depth requirement. For example, something like `**/**/b` would match `foo/bar/b`, but it wouldn't match `foo/b` even though it should. In particular, `**` semantics demand "infinite" depth, so repeated uses of `**` should just coalesce as if only one was given. We do this coalescing in the parser. It's a little tricky because we treat `**/a`, `a/**` and `a/**/b` as distinct tokens with their own regex conversions. We also test the crap out of it. Fixes #1174
This commit is contained in:
@@ -604,3 +604,12 @@ rgtest!(r1173, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create("foo", "test");
|
||||
cmd.arg("test").assert_err();
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/1174
|
||||
rgtest!(r1174, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create_dir(".git");
|
||||
dir.create(".gitignore", "**/**/*");
|
||||
dir.create_dir("a");
|
||||
dir.create("a/foo", "test");
|
||||
cmd.arg("test").assert_err();
|
||||
});
|
||||
|
Reference in New Issue
Block a user