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.
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)