Browse Source

Escape plus sign (fixes #1090)

Audrius Butkevicius 11 years ago
parent
commit
88a347dce0

+ 1 - 0
internal/fnmatch/fnmatch.go

@@ -55,6 +55,7 @@ func Convert(pattern string, flags int) (*regexp.Regexp, error) {
 		pattern = strings.Replace(pattern, "\\.", "[:escapeddot:]", -1)
 	}
 	pattern = strings.Replace(pattern, ".", "\\.", -1)
+	pattern = strings.Replace(pattern, "+", "\\+", -1)
 	pattern = strings.Replace(pattern, "**", "[:doublestar:]", -1)
 	pattern = strings.Replace(pattern, "*", any+"*", -1)
 	pattern = strings.Replace(pattern, "[:doublestar:]", ".*", -1)

+ 2 - 0
internal/ignore/ignore_test.go

@@ -55,6 +55,8 @@ func TestIgnore(t *testing.T) {
 
 		{filepath.Join("dir3"), true},
 		{filepath.Join("dir3", "afile"), true},
+
+		{"lost+found", true},
 	}
 
 	for i, tc := range tests {

+ 1 - 0
internal/ignore/testdata/.stignore

@@ -4,3 +4,4 @@ bfile
 dir1/cfile
 **/efile
 /ffile
+lost+found