Escape plus sign (fixes #1090)

This commit is contained in:
Audrius Butkevicius 2014-12-07 00:10:32 +00:00
parent 3e7b197a1d
commit 88a347dce0
3 changed files with 4 additions and 0 deletions

View File

@ -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)

View File

@ -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 {

View File

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