浏览代码

Merge pull request #5201 from nextcloud/ci/fixVfsRegressions

fix regressions on pinState management when doing renames
Matthieu Gallien 3 年之前
父节点
当前提交
f78373c11b

+ 1 - 1
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);
 

+ 1 - 1
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;

+ 2 - 0
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)) {

+ 11 - 2
src/libsync/vfs/suffix/vfs_suffix.cpp

@@ -14,12 +14,15 @@
 
 #include "vfs_suffix.h"
 
-#include <QFile>
-
 #include "syncfileitem.h"
 #include "filesystem.h"
 #include "common/syncjournaldb.h"
 
+#include <QFile>
+#include <QLoggingCategory>
+
+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);

+ 1 - 2
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> pinState(const QString &folderPath) override
     { return pinStateInDb(folderPath); }
     AvailabilityResult availability(const QString &folderPath) override;

+ 6 - 3
src/libsync/vfs/xattr/vfs_xattr.cpp

@@ -14,14 +14,16 @@
 
 #include "vfs_xattr.h"
 
-#include <QFile>
-
 #include "syncfileitem.h"
 #include "filesystem.h"
 #include "common/syncjournaldb.h"
-
 #include "xattrwrapper.h"
 
+#include <QFile>
+#include <QLoggingCategory>
+
+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);
 }