mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-15 18:08:45 -07:00
Refactor how --delete affects things
This commit is contained in:
parent
8974c33f2f
commit
c8a14d1c3d
12
model.go
12
model.go
@ -161,10 +161,6 @@ func (m *Model) Index(nodeID string, fs []protocol.FileInfo) {
|
||||
|
||||
m.remote[nodeID] = make(map[string]File)
|
||||
for _, f := range fs {
|
||||
if f.Flags&FlagDeleted != 0 && !opts.Delete {
|
||||
// Files marked as deleted do not even enter the model
|
||||
continue
|
||||
}
|
||||
m.remote[nodeID][f.Name] = fileFromFileInfo(f)
|
||||
}
|
||||
|
||||
@ -443,6 +439,14 @@ func (m *Model) recomputeNeed() {
|
||||
for n, f := range m.global {
|
||||
hf, ok := m.local[n]
|
||||
if !ok || f.Modified > hf.Modified {
|
||||
if f.Flags&FlagDeleted != 0 && !opts.Delete {
|
||||
// Don't want to delete files, so forget this need
|
||||
continue
|
||||
}
|
||||
if f.Flags&FlagDeleted != 0 && !ok {
|
||||
// Don't have the file, so don't need to delete it
|
||||
continue
|
||||
}
|
||||
m.need[n] = true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user