lib/ignore: Add directory separator to glob.Compile call

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3674
LGTM: calmh
This commit is contained in:
Simon Frei
2016-10-21 07:33:40 +00:00
committed by Jakob Borg
parent d9040f8038
commit 7c37301c91
2 changed files with 37 additions and 5 deletions

View File

@@ -737,3 +737,35 @@ func TestIssue3639(t *testing.T) {
t.Error("Should not match 'foo'")
}
}
func TestIssue3674(t *testing.T) {
stignore := `
a*b
a**c
`
testcases := []struct {
file string
matches bool
}{
{"ab", true},
{"asdfb", true},
{"ac", true},
{"asdfc", true},
{"as/db", false},
{"as/dc", true},
}
pats := New(true)
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
if err != nil {
t.Fatal(err)
}
for _, tc := range testcases {
res := pats.Match(tc.file).IsIgnored()
if res != tc.matches {
t.Errorf("Matches(%q) == %v, expected %v", tc.file, res, tc.matches)
}
}
}