lib/ignore: Only skip for toplevel includes (fixes #6487) (#6508)

This commit is contained in:
Simon Frei
2020-04-07 10:23:38 +02:00
committed by GitHub
parent b64052bc26
commit 07ce3572a0
3 changed files with 64 additions and 20 deletions
+15 -4
View File
@@ -1110,10 +1110,10 @@ func TestSkipIgnoredDirs(t *testing.T) {
{`!/t*t`, true},
{`!/t?t`, true},
{`!/**`, true},
{`!/parent/test`, true},
{`!/parent/t[eih]t`, true},
{`!/parent/t*t`, true},
{`!/parent/t?t`, true},
{`!/parent/test`, false},
{`!/parent/t[eih]t`, false},
{`!/parent/t*t`, false},
{`!/parent/t?t`, false},
{`!/**.mp3`, false},
{`!/pa*nt/test`, false},
{`!/pa[sdf]nt/t[eih]t`, false},
@@ -1150,6 +1150,17 @@ func TestSkipIgnoredDirs(t *testing.T) {
if !pats.SkipIgnoredDirs() {
t.Error("SkipIgnoredDirs should be true")
}
stignore = `
!/foo/ign*
*
`
if err := pats.Parse(bytes.NewBufferString(stignore), ".stignore"); err != nil {
t.Fatal(err)
}
if pats.SkipIgnoredDirs() {
t.Error("SkipIgnoredDirs should be false")
}
}
func TestEmptyPatterns(t *testing.T) {