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 /ignore | |
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 'ignore')
-rw-r--r-- | ignore/src/gitignore.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ignore/src/gitignore.rs b/ignore/src/gitignore.rs index 48d1bb4b..b8db42ba 100644 --- a/ignore/src/gitignore.rs +++ b/ignore/src/gitignore.rs @@ -710,6 +710,7 @@ mod tests { ignored!(ig41, ROOT, "\\a", "a"); ignored!(ig42, ROOT, "s*.rs", "sfoo.rs"); ignored!(ig43, ROOT, "**", "foo.rs"); + ignored!(ig44, ROOT, "**/**/*", "a/foo.rs"); not_ignored!(ignot1, ROOT, "amonths", "months"); not_ignored!(ignot2, ROOT, "monthsa", "months"); |