mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-17 02:48:57 -07:00
Merge pull request #850 from AudriusButkevicius/nil
Do not return nil pointers when loading ignores (fixes #846)
This commit is contained in:
commit
65acc7c9ad
@ -120,13 +120,13 @@ func (m *Matcher) Match(file string) (result bool) {
|
|||||||
|
|
||||||
func loadIgnoreFile(file string, seen map[string]bool) (*Matcher, error) {
|
func loadIgnoreFile(file string, seen map[string]bool) (*Matcher, error) {
|
||||||
if seen[file] {
|
if seen[file] {
|
||||||
return nil, fmt.Errorf("Multiple include of ignore file %q", file)
|
return &Matcher{}, fmt.Errorf("Multiple include of ignore file %q", file)
|
||||||
}
|
}
|
||||||
seen[file] = true
|
seen[file] = true
|
||||||
|
|
||||||
fd, err := os.Open(file)
|
fd, err := os.Open(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return &Matcher{}, err
|
||||||
}
|
}
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ func loadIgnoreFile(file string, seen map[string]bool) (*Matcher, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseIgnoreFile(fd io.Reader, currentFile string, seen map[string]bool) (*Matcher, error) {
|
func parseIgnoreFile(fd io.Reader, currentFile string, seen map[string]bool) (*Matcher, error) {
|
||||||
var exps Matcher
|
exps := Matcher{}
|
||||||
|
|
||||||
addPattern := func(line string) error {
|
addPattern := func(line string) error {
|
||||||
include := true
|
include := true
|
||||||
|
Loading…
Reference in New Issue
Block a user