diff options
author | Andrew Gallant <jamslam@gmail.com> | 2019-01-23 19:15:02 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2019-01-23 19:15:02 -0500 |
commit | aeaa5fc1b13bd5b903ef5660d3a6cb26b6745945 (patch) | |
tree | 17e30a965d00f0e1878a163cddc5cb70bb8ff352 /tests | |
parent | 7048a06c311317810db1c67c2828a4327eac4a60 (diff) |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regression.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs index e4da2f1c..8435f174 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -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(); +}); |