2d3e837 introduced matchType to speed up matching; that changed semantics of **.
https://docs.docker.com/build/concepts/context/#matching says ** … matches any number of directories (including zero)”. (https://git-scm.com/docs/gitignore is even more restrictive).
But consider these added test cases:
diff --git a/patternmatcher_test.go b/patternmatcher_test.go
index 5f02521..81d73fd 100644
--- a/patternmatcher_test.go
+++ b/patternmatcher_test.go
@@ -184,6 +184,14 @@ func TestMatches(t *testing.T) {
{"a.|)$(}+{bc", "a.|)$(}+{bc", true},
{"dist/proxy.py-2.4.0rc3.dev36+g08acad9-py3-none-any.whl", "dist/proxy.py-2.4.0rc3.dev36+g08acad9-py3-none-any.whl", true},
{"dist/*.whl", "dist/proxy.py-2.4.0rc3.dev36+g08acad9-py3-none-any.whl", true},
+ {"**.md", ".md", true},
+ {"**.md", "name.md", true},
+ {"**.md", "dir/.md", true},
+ {"**.md", "dir/name.md", true},
+ {"**.m[dD]", ".md", true},
+ {"**.m[dD]", "name.md", false},
+ {"**.m[dD]", "dir/.md", true},
+ {"**.m[dD]", "dir/name.md", false},
}
multiPatternTests := []multiPatternTestCase{
{[]string{"**", "!util/docker/web"}, "util/docker/web/foo", false},
The suffixMatch code path is a simple suffix, so name.md and dir/name.md match; the regexpMatch code path uses (.*/)?, so name.md and dir/name.md don’t match.
(On the other side of **, matching is also not interpreting the value as “any number of directories”, d** matches dir/name.md, but at least it is consistent between prefixMatch and regexpMatch.)
2d3e837 introduced
matchTypeto speed up matching; that changed semantics of**.https://docs.docker.com/build/concepts/context/#matching says
**… matches any number of directories (including zero)”. (https://git-scm.com/docs/gitignore is even more restrictive).But consider these added test cases:
The
suffixMatchcode path is a simple suffix, soname.mdanddir/name.mdmatch; theregexpMatchcode path uses(.*/)?, soname.mdanddir/name.mddon’t match.(On the other side of
**, matching is also not interpreting the value as “any number of directories”,d**matchesdir/name.md, but at least it is consistent betweenprefixMatchandregexpMatch.)