diff --git a/lib/db/instance.go b/lib/db/instance.go index d88dd7e3..9dc08db1 100644 --- a/lib/db/instance.go +++ b/lib/db/instance.go @@ -562,7 +562,7 @@ func (e errorSuggestion) Error() string { // unchanged checks if two files are the same and thus don't need to be updated. // Local flags or the invalid bit might change without the version -// being bumped. The IsInvalid() method handles both. +// being bumped. func unchanged(nf, ef FileIntf) bool { - return ef.FileVersion().Equal(nf.FileVersion()) && ef.IsInvalid() == nf.IsInvalid() + return ef.FileVersion().Equal(nf.FileVersion()) && ef.IsInvalid() == nf.IsInvalid() && ef.FileLocalFlags() == nf.FileLocalFlags() } diff --git a/lib/db/set_test.go b/lib/db/set_test.go index bb907c92..9fc58cc4 100644 --- a/lib/db/set_test.go +++ b/lib/db/set_test.go @@ -1462,6 +1462,33 @@ func TestSequenceIndex(t *testing.T) { } } +func TestIgnoreAfterReceiveOnly(t *testing.T) { + ldb := db.OpenMemory() + + file := "foo" + s := db.NewFileSet("test", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb) + + fs := fileList{{ + Name: file, + Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1}}}, + LocalFlags: protocol.FlagLocalReceiveOnly, + }} + + s.Update(protocol.LocalDeviceID, fs) + + fs[0].LocalFlags = protocol.FlagLocalIgnored + + s.Update(protocol.LocalDeviceID, fs) + + if f, ok := s.Get(protocol.LocalDeviceID, file); !ok { + t.Error("File missing in db") + } else if f.IsReceiveOnlyChanged() { + t.Error("File is still receive-only changed") + } else if !f.IsIgnored() { + t.Error("File is not ignored") + } +} + func replace(fs *db.FileSet, device protocol.DeviceID, files []protocol.FileInfo) { fs.Drop(device) fs.Update(device, files) diff --git a/lib/model/folder.go b/lib/model/folder.go index f99256ab..3e4472c8 100644 --- a/lib/model/folder.go +++ b/lib/model/folder.go @@ -478,7 +478,7 @@ func (f *folder) scanSubdirs(subDirs []string) error { return true } - l.Debugln("marking file as ignored", f) + l.Debugln("marking file as ignored", file) nf := file.ConvertToIgnoredFileInfo(f.shortID) batch.append(nf) changes++