lib/model: Unset local flag on deleted files (fixes #6436) (#6449)

This commit is contained in:
Simon Frei 2020-03-24 12:51:17 +01:00 committed by GitHub
parent 61302c467c
commit ddfa82e990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -64,6 +64,8 @@ func newReceiveOnlyFolder(model *model, fset *db.FileSet, ignores *ignore.Matche
} }
func (f *receiveOnlyFolder) Revert() { func (f *receiveOnlyFolder) Revert() {
l.Infof("Reverting folder %v", f.Description)
f.setState(FolderScanning) f.setState(FolderScanning)
defer f.setState(FolderIdle) defer f.setState(FolderIdle)
@ -89,6 +91,7 @@ func (f *receiveOnlyFolder) Revert() {
return true return true
} }
fi.LocalFlags &^= protocol.FlagLocalReceiveOnly
if len(fi.Version.Counters) == 1 && fi.Version.Counters[0].ID == f.shortID { if len(fi.Version.Counters) == 1 && fi.Version.Counters[0].ID == f.shortID {
// We are the only device mentioned in the version vector so the // We are the only device mentioned in the version vector so the
// file must originate here. A revert then means to delete it. // file must originate here. A revert then means to delete it.
@ -113,7 +116,6 @@ func (f *receiveOnlyFolder) Revert() {
// either, so we will not create a conflict copy of our local // either, so we will not create a conflict copy of our local
// changes. // changes.
fi.Version = protocol.Vector{} fi.Version = protocol.Vector{}
fi.LocalFlags &^= protocol.FlagLocalReceiveOnly
} }
batch = append(batch, fi) batch = append(batch, fi)

View File

@ -97,6 +97,8 @@ func (f *sendOnlyFolder) pull() bool {
} }
func (f *sendOnlyFolder) Override() { func (f *sendOnlyFolder) Override() {
l.Infof("Overriding global state on folder %v", f.Description)
f.setState(FolderScanning) f.setState(FolderScanning)
batch := make([]protocol.FileInfo, 0, maxBatchSizeFiles) batch := make([]protocol.FileInfo, 0, maxBatchSizeFiles)
batchSizeBytes := 0 batchSizeBytes := 0