From 89f8be40c6513292c5a53f5807591c40be75684d Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 10 Feb 2017 11:22:09 +0000 Subject: [PATCH] lib/model: Use ignore patterns in remote completion calculation Basically, if we don't care about the sync status of the file we should not tag someone else out of sync because they don't have the latest version. This solves *my* "Syncing - 100%" scenario at least. The reason this happens seems to be like this, in my situation. I have three devices, connected in a "line": A-B-C. A is a Mac and litters .DS_Store files everywhere. I've ignored these, but some escaped into the folders before I did so. I've also ignored them on B and C but at different stages. B was flagging C as out of sync, because at the point the ignores were introduced C had a lower version of .DS_Store than A. Now none of them are sending updates about it any more since it's ignored... GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3981 --- lib/model/model.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/model/model.go b/lib/model/model.go index fed996e1..9d7ab887 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -486,6 +486,7 @@ type FolderCompletion struct { func (m *Model) Completion(device protocol.DeviceID, folder string) FolderCompletion { m.fmut.RLock() rf, ok := m.folderFiles[folder] + ignores := m.folderIgnores[folder] m.fmut.RUnlock() if !ok { return FolderCompletion{} // Folder doesn't exist, so we hardly have any of it @@ -505,6 +506,10 @@ func (m *Model) Completion(device protocol.DeviceID, folder string) FolderComple var need, fileNeed, downloaded, deletes int64 rf.WithNeedTruncated(device, func(f db.FileIntf) bool { + if ignores.Match(f.FileName()).IsIgnored() { + return true + } + ft := f.(db.FileInfoTruncated) // If the file is deleted, we account it only in the deleted column.