mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 01:23:24 -08:00
Fix ZeldaZach review for PR 7495: three-way baseHash check before conflict
This commit is contained in:
parent
d2e2e722e7
commit
9e4d734373
1 changed files with 18 additions and 0 deletions
|
|
@ -372,6 +372,24 @@ void DeckSyncManager::classify(const QMap<QString, ServerFile> &serverFiles)
|
||||||
++unchangedCount;
|
++unchangedCount;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const DeckSyncRecord baseRecord = sidecar.get(it.key());
|
||||||
|
const bool localChanged = baseRecord.baseHash.isEmpty() || baseRecord.baseHash != it.value().hash;
|
||||||
|
const bool serverChanged = baseRecord.baseHash.isEmpty() || baseRecord.baseHash != serverIt.value().hash;
|
||||||
|
if (localChanged && !serverChanged) {
|
||||||
|
if (syncMode == DeckSyncMode::DownloadOnly) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
applyUpload(it.key(), serverPath, serverIt.value().id, serverIt.value().guid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!localChanged && serverChanged) {
|
||||||
|
if (syncMode == DeckSyncMode::UploadOnly) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
applyDownload(it.key(), serverIt.value().id, serverIt.value().guid, serverIt.value().hash,
|
||||||
|
serverIt.value().lastModifiedSecs);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const qint64 localSecs = it.value().modified.toSecsSinceEpoch();
|
const qint64 localSecs = it.value().modified.toSecsSinceEpoch();
|
||||||
const int effective = sessionDefault >= 0 ? sessionDefault : conflictDefault;
|
const int effective = sessionDefault >= 0 ? sessionDefault : conflictDefault;
|
||||||
// A server row without last_modified predates sync: the local file wins.
|
// A server row without last_modified predates sync: the local file wins.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue