fix(ignore): handle pattern resulting in empty string (#10835)
Minor fix to avoid a panic in ignore matching. Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -299,6 +299,17 @@ func TestCommentsAndBlankLines(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNegatedGlobstarOnly(t *testing.T) {
|
||||
testFs := newTestFS()
|
||||
|
||||
pats := New(testFs)
|
||||
if err := pats.Parse(bytes.NewBufferString("!**/\n"), ".stignore"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Must not panic on an empty pattern component.
|
||||
pats.Match("foo")
|
||||
}
|
||||
|
||||
var result ignoreresult.R
|
||||
|
||||
func BenchmarkMatch(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user