mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
lib/ignore: Consistent behaviour for nil *Matcher
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4310
This commit is contained in:
parent
baec3f909c
commit
9dbc509996
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user