pull checks need for files that only differ by metadata (no changes on disk)
(ctx context.Context)
| 40 | |
| 41 | // pull checks need for files that only differ by metadata (no changes on disk) |
| 42 | func (f *sendOnlyFolder) pull(ctx context.Context) (bool, error) { |
| 43 | batch := NewFileInfoBatch(func(files []protocol.FileInfo) error { |
| 44 | f.updateLocalsFromPulling(files) |
| 45 | return nil |
| 46 | }) |
| 47 | |
| 48 | for file, err := range itererr.Zip(f.db.AllNeededGlobalFiles(f.folderID, protocol.LocalDeviceID, config.PullOrderAlphabetic, 0, 0)) { |
| 49 | if err != nil { |
| 50 | return false, err |
| 51 | } |
| 52 | if err := batch.FlushIfFull(); err != nil { |
| 53 | return false, err |
| 54 | } |
| 55 | |
| 56 | if f.ignores.Match(file.FileName()).IsIgnored() { |
| 57 | file.SetIgnored() |
| 58 | batch.Append(file) |
| 59 | l.Debugln(f, "Handling ignored file", file) |
| 60 | continue |
| 61 | } |
| 62 | |
| 63 | curFile, ok, err := f.db.GetDeviceFile(f.folderID, protocol.LocalDeviceID, file.FileName()) |
| 64 | if err != nil { |
| 65 | return false, err |
| 66 | } |
| 67 | if !ok { |
| 68 | if file.IsInvalid() || file.IsDeleted() { |
| 69 | // Accept the file for accounting purposes |
| 70 | batch.Append(file) |
| 71 | } |
| 72 | continue |
| 73 | } |
| 74 | |
| 75 | if !file.IsEquivalentOptional(curFile, protocol.FileInfoComparison{ |
| 76 | ModTimeWindow: f.modTimeWindow, |
| 77 | IgnorePerms: f.IgnorePerms, |
| 78 | IgnoreOwnership: !f.SyncOwnership, |
| 79 | IgnoreXattrs: !f.SyncXattrs, |
| 80 | }) { |
| 81 | continue |
| 82 | } |
| 83 | |
| 84 | batch.Append(file) |
| 85 | l.Debugln(f, "Merging versions of identical file", file) |
| 86 | } |
| 87 | |
| 88 | batch.Flush() |
| 89 | |
| 90 | return true, nil |
| 91 | } |
| 92 | |
| 93 | func (f *sendOnlyFolder) Override() { |
| 94 | f.doInSync(f.override) |
nothing calls this directly
no test coverage detected