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
This commit is contained in:
Jakob Borg 2017-02-10 11:22:09 +00:00 committed by Audrius Butkevicius
parent 96fba1b322
commit 89f8be40c6

View File

@ -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.