From 80b9a3e00bf4ed39f417b6dea028896d888acffe Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Wed, 30 Dec 2015 21:30:47 +0000 Subject: [PATCH] Don't warn about failed ignores if folder unhealthy (fixes #2630) --- lib/model/model.go | 4 ++++ lib/model/model_test.go | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/model/model.go b/lib/model/model.go index a270cc7f2..50c9d466f 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -893,6 +893,10 @@ func (m *Model) GetIgnores(folder string) ([]string, []string, error) { return lines, nil, fmt.Errorf("Folder %s does not exist", folder) } + if !cfg.HasMarker() { + return lines, nil, fmt.Errorf("Folder %s stopped", folder) + } + fd, err := os.Open(filepath.Join(cfg.Path(), ".stignore")) if err != nil { if os.IsNotExist(err) { diff --git a/lib/model/model_test.go b/lib/model/model_test.go index 3b92fe6be..12b1b31fb 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -514,13 +514,11 @@ func TestIgnores(t *testing.T) { t.Error("No error") } + // Invalid path, marker should be missing, hence returns an error. m.AddFolder(config.FolderConfiguration{ID: "fresh", RawPath: "XXX"}) ignores, _, err = m.GetIgnores("fresh") - if err != nil { - t.Error(err) - } - if len(ignores) > 0 { - t.Errorf("Expected no ignores, got: %v", ignores) + if err == nil { + t.Error("No error") } }