mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
PropagateDirectory: Set initial dir mtime to server mtime #7119
It's still not synced in any way later.
This commit is contained in:
parent
69887c531e
commit
cd10e3d28c
2 changed files with 22 additions and 0 deletions
|
@ -965,6 +965,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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue