Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsync/owncloudpropagator.cpp6
-rw-r--r--test/testsyncengine.cpp16
2 files changed, 22 insertions, 0 deletions
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index 6f5063ea2..f4ab0e9d4 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -974,6 +974,12 @@ void PropagateDirectory::slotSubJobsFinished(SyncFileItem::Status status)
propagator()->_journal->deleteFileRecord(_item->_originalFile, true);
}
+ if (_item->_instruction == CSYNC_INSTRUCTION_NEW && _item->_direction == SyncFileItem::Down) {
+ // special case for local MKDIR, set local directory mtime
+ // (it's not synced later at all, but can be nice to have it set initially)
+ FileSystem::setModTime(propagator()->getFilePath(_item->destination()), _item->_modtime);
+ }
+
// For new directories we always want to update the etag once
// the directory has been propagated. Otherwise the directory
// could appear locally without being added to the database.
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index 830d25d8f..62cee4b4e 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -698,6 +698,22 @@ private slots:
QCOMPARE(QFileInfo(fakeFolder.localPath() + conflictName).permissions(), perm);
}
#endif
+
+ // Check that server mtime is set on directories on initial propagation
+ void testDirectoryInitialMtime()
+ {
+ FakeFolder fakeFolder{ FileInfo{} };
+ fakeFolder.remoteModifier().mkdir("foo");
+ fakeFolder.remoteModifier().insert("foo/bar");
+ auto datetime = QDateTime::currentDateTime();
+ datetime.setSecsSinceEpoch(datetime.toSecsSinceEpoch()); // wipe ms
+ fakeFolder.remoteModifier().find("foo")->lastModified = datetime;
+
+ QVERIFY(fakeFolder.syncOnce());
+ QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
+
+ QCOMPARE(QFileInfo(fakeFolder.localPath() + "foo").lastModified(), datetime);
+ }
};
QTEST_GUILESS_MAIN(TestSyncEngine)