-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Hi, just ran into a bug where lines that only contain whitespace cause a panic in the parser. This is quite a tricky one to diagnose because such lines are very hard to spot.
Reproduction:
package main
import "github.com/denormal/go-gitignore"
func main() {
// or match against a repository
// - here we match a directory path relative to the repository
matcher, err := gitignore.NewRepository( "/tmp/panic" )
if err != nil {
panic(err)
}
matcher.Relative("panic_test", false)
}
Panics if the file /tmp/panic/.gitignore
contains a line with a single space e.g.
# Next line contains just whitespace
Metadata
Metadata
Assignees
Labels
No labels