lib: Modify FileInfos consistently (ref #6321) (#6349)

This commit is contained in:
Simon Frei
2020-02-22 09:31:26 +01:00
committed by Jakob Borg
parent bb375b1aff
commit a4bd4d118a
6 changed files with 57 additions and 41 deletions
+2 -1
View File
@@ -532,7 +532,8 @@ func (f *folder) scanSubdirs(subDirs []string) error {
}
return true
}
nf := file.ConvertToDeletedFileInfo(f.shortID, f.localFlags)
nf := file.ConvertToDeletedFileInfo(f.shortID)
nf.LocalFlags = f.localFlags
if file.ShouldConflict() {
// We do not want to override the global version with
// the deleted file. Setting to an empty version makes
+2 -8
View File
@@ -104,14 +104,8 @@ func (f *receiveOnlyFolder) Revert() {
return true // continue
}
fi = protocol.FileInfo{
Name: fi.Name,
Type: fi.Type,
ModifiedS: time.Now().Unix(),
ModifiedBy: f.shortID,
Deleted: true,
Version: protocol.Vector{}, // if this file ever resurfaces anywhere we want our delete to be strictly older
}
fi.SetDeleted(f.shortID)
fi.Version = protocol.Vector{} // if this file ever resurfaces anywhere we want our delete to be strictly older
} else {
// Revert means to throw away our local changes. We reset the
// version to the empty vector, which is strictly older than any
+1 -4
View File
@@ -118,10 +118,7 @@ func (f *sendOnlyFolder) Override() {
}
if !ok || have.Name != need.Name {
// We are missing the file
need.Deleted = true
need.Blocks = nil
need.Version = need.Version.Update(f.shortID)
need.Size = 0
need.SetDeleted(f.shortID)
} else {
// We have the file, replace with our version
have.Version = have.Version.Merge(need.Version).Update(f.shortID)