[Pkg-owncloud-commits] [owncloud-client] 68/84: SyncEngine: Fix renaming of folder when file are changed (#5195)

Sandro Knauß hefee at moszumanska.debian.org
Fri Oct 21 22:51:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch master
in repository owncloud-client.

commit 6f1b03c5603784556fd439f5c6d8c614265226d8
Author: Olivier Goffart <olivier at woboq.com>
Date:   Thu Sep 22 09:02:47 2016 +0200

    SyncEngine: Fix renaming of folder when file are changed (#5195)
    
    Two bugs:
     - The change filed are not considered as move, they are re-downloaded
       but the old file was not removed from the database. The change in
       owncloudpropagator.cpp takes care of removing the old entries.
    
     - Next sync would then remove the file in the server in the old folder
       This was not a problem until we start reusing the sync engine, and
       that the _renamedFolders map is not cleared. We were before deleting
       a non-existing file. But now we delete the actual file.
    
    Also improve the tests to be able to do move on the server.
    This include support for file id.
    
    Issue #5192
    (cherry picked from commit 85b8ab178e21cf4dcaf792f68c15e55f6e0ee3c2)
---
 src/libsync/owncloudpropagator.cpp | 6 ++++++
 src/libsync/syncengine.cpp         | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index 72046fc..998160c 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -695,6 +695,12 @@ void PropagateDirectory::finalize()
     bool ok = true;
     if (!_item->isEmpty() && _hasError == SyncFileItem::NoStatus) {
         if( !_item->_renameTarget.isEmpty() ) {
+            if(_item->_instruction == CSYNC_INSTRUCTION_RENAME
+                    && _item->_originalFile != _item->_renameTarget) {
+                // Remove the stale entries from the database.
+                _propagator->_journal->deleteFileRecord(_item->_originalFile, true);
+            }
+
             _item->_file = _item->_renameTarget;
         }
 
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index a9f9701..636ffb1 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -856,6 +856,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
     bool walkOk = true;
     _seenFiles.clear();
     _temporarilyUnavailablePaths.clear();
+    _renamedFolders.clear();
 
     if( csync_walk_local_tree(_csync_ctx, &treewalkLocal, 0) < 0 ) {
         qDebug() << "Error in local treewalk.";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list