diff --git a/lib/ignore/ignore.go b/lib/ignore/ignore.go index 3537c903..d56f4157 100644 --- a/lib/ignore/ignore.go +++ b/lib/ignore/ignore.go @@ -173,7 +173,7 @@ func (m *Matcher) parseLocked(r io.Reader, file string) error { } func (m *Matcher) Match(file string) (result Result) { - if m == nil || file == "." { + if file == "." { return resultNotMatched } @@ -228,10 +228,6 @@ func (m *Matcher) Lines() []string { // Patterns return a list of the loaded patterns, as they've been parsed func (m *Matcher) Patterns() []string { - if m == nil { - return nil - } - m.mut.Lock() defer m.mut.Unlock() diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go index 9339cdf1..c2717b72 100644 --- a/lib/scanner/walk.go +++ b/lib/scanner/walk.go @@ -85,6 +85,9 @@ func Walk(ctx context.Context, cfg Config) (chan protocol.FileInfo, error) { if w.Filesystem == nil { panic("no filesystem specified") } + if w.Matcher == nil { + w.Matcher = ignore.New(w.Filesystem) + } return w.walk(ctx) }