From 9a06128eec7f568c96c71c627a953a2cce6d9700 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 26 Oct 2022 18:13:55 +0200 Subject: [PATCH] remove dead code related to item renaming Signed-off-by: Matthieu Gallien --- src/libsync/discovery.cpp | 65 ------------------------------------ src/libsync/discoveryphase.h | 2 -- 2 files changed, 67 deletions(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 57426dd8a..8605d6255 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -615,24 +615,6 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( // Unknown in db: new file on the server Q_ASSERT(!dbEntry.isValid()); - if (!serverEntry.renameName.isEmpty()) { - item->_renameTarget = _dirItem ? _dirItem->_file + "/" + serverEntry.renameName : serverEntry.renameName; - item->_originalFile = path._original; - item->_modtime = serverEntry.modtime; - item->_size = serverEntry.size; - item->_instruction = CSYNC_INSTRUCTION_RENAME; - item->_direction = SyncFileItem::Up; - item->_fileId = serverEntry.fileId; - item->_remotePerm = serverEntry.remotePerm; - item->_isShared = serverEntry.remotePerm.hasPermission(RemotePermissions::IsShared); - item->_lastShareStateFetchedTimestmap = QDateTime::currentMSecsSinceEpoch(); - item->_etag = serverEntry.etag; - item->_type = serverEntry.isDirectory ? CSyncEnums::ItemTypeDirectory : CSyncEnums::ItemTypeFile; - - processFileAnalyzeLocalInfo(item, path, localEntry, serverEntry, dbEntry, _queryServer); - return; - } - item->_instruction = CSYNC_INSTRUCTION_NEW; item->_direction = SyncFileItem::Down; item->_modtime = serverEntry.modtime; @@ -881,41 +863,6 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( processFileFinalize(item, path, recurse, recurseQueryLocal, recurseQueryServer); }; - auto handleInvalidSpaceRename = [&] (SyncFileItem::Direction direction) { - if (_dirItem) { - path._target = _dirItem->_file + "/" + localEntry.renameName; - } else { - path._target = localEntry.renameName; - } - OCC::SyncJournalFileRecord base; - if (!_discoveryData->_statedb->getFileRecordByInode(localEntry.inode, &base)) { - dbError(); - return; - } - const auto originalPath = base.path(); - const auto adjustedOriginalPath = _discoveryData->adjustRenamedPath(originalPath, SyncFileItem::Down); - _discoveryData->_renamedItemsLocal.insert(originalPath, path._target); - item->_renameTarget = path._target; - path._server = adjustedOriginalPath; - if (_dirItem) { - item->_file = _dirItem->_file + "/" + localEntry.name; - } else { - item->_file = localEntry.name; - } - path._original = originalPath; - item->_originalFile = path._original; - item->_modtime = base.isValid() ? base._modtime : localEntry.modtime; - item->_inode = base.isValid() ? base._inode : localEntry.inode; - item->_instruction = CSYNC_INSTRUCTION_RENAME; - item->_direction = direction; - item->_fileId = base.isValid() ? base._fileId : QByteArray{}; - item->_remotePerm = base.isValid() ? base._remotePerm : RemotePermissions{}; - item->_etag = base.isValid() ? base._etag : QByteArray{}; - item->_type = base.isValid() ? base._type : localEntry.type; - item->_isShared = base.isValid() ? base._isShared : false; - item->_lastShareStateFetchedTimestmap = base.isValid() ? base._lastShareStateFetchedTimestmap : 0; - }; - if (!localEntry.isValid()) { if (_queryLocal == ParentNotChanged && dbEntry.isValid()) { // Not modified locally (ParentNotChanged) @@ -1000,8 +947,6 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( || _discoveryData->_syncOptions._vfs->needsMetadataUpdate(*item))) { item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA; item->_direction = SyncFileItem::Down; - } else if (!localEntry.renameName.isEmpty()) { - handleInvalidSpaceRename(SyncFileItem::Up); } } else if (!typeChange && isVfsWithSuffix() && dbEntry.isVirtualFile() && !localEntry.isVirtualFile @@ -1097,16 +1042,6 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( return; } - if (!localEntry.renameName.isEmpty()) { - handleInvalidSpaceRename(SyncFileItem::Down); - item->_instruction = CSYNC_INSTRUCTION_NEW; - item->_direction = SyncFileItem::Up; - item->_originalFile = item->_file; - item->_file = item->_renameTarget; - finalize(); - return; - } - // New local file or rename item->_instruction = CSYNC_INSTRUCTION_NEW; item->_direction = SyncFileItem::Up; diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 0acb862d2..6c633d1bf 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -49,7 +49,6 @@ struct RemoteInfo { /** FileName of the entry (this does not contains any directory or path, just the plain name */ QString name; - QString renameName; QByteArray etag; QByteArray fileId; QByteArray checksumHeader; @@ -79,7 +78,6 @@ struct LocalInfo { /** FileName of the entry (this does not contains any directory or path, just the plain name */ QString name; - QString renameName; time_t modtime = 0; int64_t size = 0; uint64_t inode = 0;