There was an error while loading. Please reload this page.
1 parent 465a339 commit 09b9aeeCopy full SHA for 09b9aee
doublestar_test.go
@@ -99,7 +99,9 @@ var matchTests = []MatchTest{
99
{"[abc]", "b", true, true, nil, false, false, true, true, 3, 3},
100
{"**", "", true, true, nil, false, false, false, false, 38, 38},
101
{"a/**", "a", true, true, nil, false, false, false, true, 7, 7},
102
+ {"a/**/", "a", true, true, nil, false, false, false, false, 4, 4},
103
{"a/**", "a/", true, true, nil, false, false, false, false, 7, 7},
104
+ {"a/**/", "a/", true, true, nil, false, false, false, false, 4, 4},
105
{"a/**", "a/b", true, true, nil, false, false, false, true, 7, 7},
106
{"a/**", "a/b/c", true, true, nil, false, false, false, true, 7, 7},
107
{"**/c", "c", true, true, nil, !onWindows, false, false, true, 5, 4},
match.go
@@ -301,9 +301,14 @@ MATCH:
301
}
302
303
func isZeroLengthPattern(pattern string, separator rune) (ret bool, err error) {
304
- // `/**` is a special case - a pattern such as `path/to/a/**` *should* match
305
- // `path/to/a` because `a` might be a directory
306
- if pattern == "" || pattern == "*" || pattern == "**" || pattern == string(separator)+"**" {
+ // `/**`, `**/`, and `/**/` are special cases - a pattern such as `path/to/a/**` or `path/to/a/**/`
+ // *should* match `path/to/a` because `a` might be a directory
+ if pattern == "" ||
307
+ pattern == "*" ||
308
+ pattern == "**" ||
309
+ pattern == string(separator)+"**" ||
310
+ pattern == "**"+string(separator) ||
311
+ pattern == string(separator)+"**"+string(separator) {
312
return true, nil
313
314
0 commit comments