diff --git a/doublestar.go b/doublestar.go index 05d470b..3a705f6 100644 --- a/doublestar.go +++ b/doublestar.go @@ -52,25 +52,6 @@ func splitPathOnSeparator(path string, separator rune) (ret []string) { } } - // An empty component in the beginning is significant because it indicates an - // absolute path, and an empty component at the end is significant because it - // indicates that the path ended on a path separator. However, empty - // components in the middle are insignificant; they probably indicate a typo - // or a path that was built programmatically without removing duplicate - // separators. We'll remove the inner empty components here... - shift := 0 - for i := 1; i < idx-1; i++ { - if ret[i] == "" { - shift++ - } else if shift > 0 { - ret[i-shift] = ret[i] - } - } - if shift > 0 { - ret[idx-1-shift] = ret[idx-1] - idx -= shift - } - return ret[:idx] } diff --git a/doublestar_test.go b/doublestar_test.go index 85b1877..77d388d 100644 --- a/doublestar_test.go +++ b/doublestar_test.go @@ -27,6 +27,7 @@ var matchTests = []MatchTest{ {[]string{"*"}, []string{"/"}, false, nil, false}, {[]string{"/*"}, []string{"/"}, true, nil, false}, {[]string{"/*"}, []string{"/debug/"}, false, nil, false}, + {[]string{"/*"}, []string{"//"}, false, nil, false}, {[]string{"abc"}, []string{"abc"}, true, nil, true}, {[]string{"*"}, []string{"abc"}, true, nil, true}, {[]string{"*c"}, []string{"abc"}, true, nil, true},