From bb378902aeaed620b3be719fcca637f7d5ec286b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 6 Feb 2014 17:16:22 +0100 Subject: [PATCH] Also force an update of the etag in case of renames Imagine we have a file: foo/bar/moo if we do mv 'foo' 'foo2' and that we issue a MOVE on the server and will update the entry 'foo' in the database with the new etag If we write the etag of foo but not the etag of the sub item, when we read from db on the next sync, we will miss them and beleive they have been removed on the server --- csync/src/csync_update.c | 3 ++- src/mirall/owncloudpropagator.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index f6cecbc2a..c903371cc 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -620,7 +620,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, } if (ctx->current_fs && (ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL || - ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW)) { + ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW || + ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL_RENAME)) { ctx->current_fs->should_update_etag = true; } diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index 6e9109b04..d935c8a67 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -866,7 +866,9 @@ void PropagateLocalRename::start() SyncJournalFileRecord record(_item, _propagator->_localDir + _item._renameTarget); record._path = _item._renameTarget; - _propagator->_journal->setFileRecord(record); + if (!_item._isDirectory) { // Directory are saved at the end + _propagator->_journal->setFileRecord(record); + } _propagator->_journal->commit("localRename");