mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Fix ZeldaZach review for PR 7495: three-way baseHash check before conflict
This commit is contained in:
parent
339d712308
commit
0f413b1466
1 changed files with 18 additions and 0 deletions
|
|
@ -372,6 +372,24 @@ void DeckSyncManager::classify(const QMap<QString, ServerFile> &serverFiles)
|
|||
++unchangedCount;
|
||||
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 int effective = sessionDefault >= 0 ? sessionDefault : conflictDefault;
|
||||
// A server row without last_modified predates sync: the local file wins.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue