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
This commit is contained in:
Olivier Goffart 2014-02-06 17:16:22 +01:00
parent 8f1494f8f2
commit bb378902ae
2 changed files with 5 additions and 2 deletions

View file

@ -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;
}

View file

@ -866,7 +866,9 @@ void PropagateLocalRename::start()
SyncJournalFileRecord record(_item, _propagator->_localDir + _item._renameTarget);
record._path = _item._renameTarget;
if (!_item._isDirectory) { // Directory are saved at the end
_propagator->_journal->setFileRecord(record);
}
_propagator->_journal->commit("localRename");