mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-12 16:26:37 +00:00
lib/model: Fix flaky test and add some scanning debug (#7214)
This commit is contained in:
parent
fa40ccece1
commit
d904dfa191
@ -392,6 +392,8 @@ func (f *folder) pull() (success bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *folder) scanSubdirs(subDirs []string) error {
|
func (f *folder) scanSubdirs(subDirs []string) error {
|
||||||
|
l.Debugf("%v scanning", f)
|
||||||
|
|
||||||
oldHash := f.ignores.Hash()
|
oldHash := f.ignores.Hash()
|
||||||
|
|
||||||
err := f.getHealthErrorAndLoadIgnores()
|
err := f.getHealthErrorAndLoadIgnores()
|
||||||
@ -493,6 +495,7 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|||||||
// changes.
|
// changes.
|
||||||
changes := 0
|
changes := 0
|
||||||
defer func() {
|
defer func() {
|
||||||
|
l.Debugf("%v finished scanning, detected %v changes", f, changes)
|
||||||
if changes > 0 {
|
if changes > 0 {
|
||||||
f.SchedulePull()
|
f.SchedulePull()
|
||||||
}
|
}
|
||||||
@ -508,6 +511,7 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|||||||
case gf.IsEquivalentOptional(fi, f.modTimeWindow, false, false, protocol.FlagLocalReceiveOnly):
|
case gf.IsEquivalentOptional(fi, f.modTimeWindow, false, false, protocol.FlagLocalReceiveOnly):
|
||||||
// What we have locally is equivalent to the global file.
|
// What we have locally is equivalent to the global file.
|
||||||
fi.Version = gf.Version
|
fi.Version = gf.Version
|
||||||
|
l.Debugf("%v scanning: Merging identical locally changed item with global", f, fi)
|
||||||
fallthrough
|
fallthrough
|
||||||
case fi.IsDeleted() && (gf.IsReceiveOnlyChanged() || gf.IsDeleted()):
|
case fi.IsDeleted() && (gf.IsReceiveOnlyChanged() || gf.IsDeleted()):
|
||||||
// Our item is deleted and the global item is our own
|
// Our item is deleted and the global item is our own
|
||||||
@ -515,6 +519,7 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|||||||
// case we can't delete file infos, so we just
|
// case we can't delete file infos, so we just
|
||||||
// pretend it is a normal deleted file (nobody
|
// pretend it is a normal deleted file (nobody
|
||||||
// cares about that).
|
// cares about that).
|
||||||
|
l.Debugf("%v scanning: Marking item as not locally changed", f, fi)
|
||||||
fi.LocalFlags &^= protocol.FlagLocalReceiveOnly
|
fi.LocalFlags &^= protocol.FlagLocalReceiveOnly
|
||||||
}
|
}
|
||||||
batch.append(fi)
|
batch.append(fi)
|
||||||
|
@ -393,9 +393,13 @@ func TestRecvOnlyRemoteUndoChanges(t *testing.T) {
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
snap.Release()
|
snap.Release()
|
||||||
m.Index(device1, "ro", files)
|
m.IndexUpdate(device1, "ro", files)
|
||||||
|
|
||||||
must(t, m.ScanFolder("ro"))
|
// Ensure the pull to resolve conflicts (content identical) happened
|
||||||
|
must(t, f.doInSync(func() error {
|
||||||
|
f.pull()
|
||||||
|
return nil
|
||||||
|
}))
|
||||||
|
|
||||||
size = receiveOnlyChangedSize(t, m, "ro")
|
size = receiveOnlyChangedSize(t, m, "ro")
|
||||||
if size.Files+size.Directories+size.Deleted != 0 {
|
if size.Files+size.Directories+size.Deleted != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user