mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 23:08:27 +00: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)
|
m.remote[nodeID] = make(map[string]File)
|
||||||
for _, f := range fs {
|
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)
|
m.remote[nodeID][f.Name] = fileFromFileInfo(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,6 +439,14 @@ func (m *Model) recomputeNeed() {
|
|||||||
for n, f := range m.global {
|
for n, f := range m.global {
|
||||||
hf, ok := m.local[n]
|
hf, ok := m.local[n]
|
||||||
if !ok || f.Modified > hf.Modified {
|
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
|
m.need[n] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user