From: Matthieu Gallien Date: Wed, 23 Nov 2022 17:04:46 +0000 (+0100) Subject: fix regressions on pinState management when doing renames X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~117^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=60566eec0054b19fe592c0f7b09ada3432ab02b6;p=nextcloud-desktop.git fix regressions on pinState management when doing renames Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/propagateremotemove.cpp b/src/libsync/propagateremotemove.cpp index d42ba3269..882d7e077 100644 --- a/src/libsync/propagateremotemove.cpp +++ b/src/libsync/propagateremotemove.cpp @@ -251,7 +251,7 @@ void PropagateRemoteMove::finalize() return; } auto &vfs = propagator()->syncOptions()._vfs; - auto pinState = vfs->pinState(_item->_renameTarget); + auto pinState = vfs->pinState(_item->_originalFile); const auto targetFile = propagator()->fullLocalPath(_item->_renameTarget); diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index ce507b790..8002f31e4 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -277,7 +277,7 @@ void PropagateLocalRename::start() return; } - if (pinState != OCC::PinState::Unspecified && !vfs->setPinState(_item->_renameTarget, pinState)) { + if (!vfs->setPinState(_item->_renameTarget, pinState)) { qCWarning(lcPropagateLocalRename) << "Could not set pin state of" << _item->_renameTarget << "to old value" << pinState; done(SyncFileItem::NormalError, tr("Error setting pin state")); return; diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 3ac65422a..af5347ff6 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -289,6 +289,8 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) bool VfsCfApi::setPinState(const QString &folderPath, PinState state) { + qCDebug(lcCfApi) << "setPinState" << folderPath << state; + const auto localPath = QDir::toNativeSeparators(params().filesystemPath + folderPath); if (cfapi::setPinState(localPath, state, cfapi::Recurse)) { diff --git a/src/libsync/vfs/suffix/vfs_suffix.cpp b/src/libsync/vfs/suffix/vfs_suffix.cpp index 21a7fd950..6fcb1d2f5 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.cpp +++ b/src/libsync/vfs/suffix/vfs_suffix.cpp @@ -14,12 +14,15 @@ #include "vfs_suffix.h" -#include - #include "syncfileitem.h" #include "filesystem.h" #include "common/syncjournaldb.h" +#include +#include + +Q_LOGGING_CATEGORY(lcVfsSuffix, "nextcloud.sync.vfs.suffix", QtInfoMsg) + namespace OCC { VfsSuffix::VfsSuffix(QObject *parent) @@ -158,6 +161,12 @@ bool VfsSuffix::statTypeVirtualFile(csync_file_stat_t *stat, void *) return false; } +bool VfsSuffix::setPinState(const QString &folderPath, PinState state) +{ + qCDebug(lcVfsSuffix) << "setPinState" << folderPath << state; + return setPinStateInDb(folderPath, state); +} + Vfs::AvailabilityResult VfsSuffix::availability(const QString &folderPath) { return availabilityInDb(folderPath); diff --git a/src/libsync/vfs/suffix/vfs_suffix.h b/src/libsync/vfs/suffix/vfs_suffix.h index 66b8f74cb..6169290ba 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.h +++ b/src/libsync/vfs/suffix/vfs_suffix.h @@ -48,8 +48,7 @@ public: bool isDehydratedPlaceholder(const QString &filePath) override; bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) override; - bool setPinState(const QString &folderPath, PinState state) override - { return setPinStateInDb(folderPath, state); } + bool setPinState(const QString &folderPath, PinState state) override; Optional pinState(const QString &folderPath) override { return pinStateInDb(folderPath); } AvailabilityResult availability(const QString &folderPath) override; diff --git a/src/libsync/vfs/xattr/vfs_xattr.cpp b/src/libsync/vfs/xattr/vfs_xattr.cpp index 6a15067ac..4300f6d30 100644 --- a/src/libsync/vfs/xattr/vfs_xattr.cpp +++ b/src/libsync/vfs/xattr/vfs_xattr.cpp @@ -14,14 +14,16 @@ #include "vfs_xattr.h" -#include - #include "syncfileitem.h" #include "filesystem.h" #include "common/syncjournaldb.h" - #include "xattrwrapper.h" +#include +#include + +Q_LOGGING_CATEGORY(lcVfsXAttr, "nextcloud.sync.vfs.xattr", QtInfoMsg) + namespace xattr { using namespace OCC::XAttrWrapper; } @@ -172,6 +174,7 @@ bool VfsXAttr::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) bool VfsXAttr::setPinState(const QString &folderPath, PinState state) { + qCDebug(lcVfsXAttr) << "setPinState" << folderPath << state; return setPinStateInDb(folderPath, state); }