Sync engine: Do not write to the database too early

It is possible that we have should_update_etag set to true for files
that we also need to propagate.  In which case we must not write to the DB
too early as this could cause data loss.  (cf: issue #2296)
This commit is contained in:
Olivier Goffart 2014-10-11 15:38:12 +02:00
parent d491663143
commit 9b178c5bb2

View File

@ -402,7 +402,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
int re = 0;
switch(file->instruction) {
case CSYNC_INSTRUCTION_NONE:
if (file->should_update_etag && !item._isDirectory) {
if (remote && item._should_update_etag && !item._isDirectory && item._instruction == CSYNC_INSTRUCTION_NONE) {
// Update the database now already (new fileid or etag or remotePerm)
// Those are files that were detected as "resolved conflict".
// They should have been a conflict because they both were new, or both