Virtual Files: Set the mtime of the virtual file to that of the server

Note: When the server mtime is modified, the mtime of the file is not updated

Issue #6727
This commit is contained in:
Olivier Goffart 2018-08-18 09:14:01 +02:00 коммит произвёл Kevin Ottens
Родитель a17a2a9c06
Коммит 73d933115a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 074BBBCB8DECC9E2
2 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -402,6 +402,7 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
file.open(QFile::ReadWrite | QFile::Truncate);
file.write(" ");
file.close();
FileSystem::setModTime(fn, _item->_modtime);
updateMetadata(false);
return;
}

Просмотреть файл

@ -68,9 +68,12 @@ private slots:
// Create a virtual file for a new remote file
fakeFolder.remoteModifier().mkdir("A");
fakeFolder.remoteModifier().insert("A/a1", 64);
auto someDate = QDateTime(QDate(1984, 07, 30), QTime(1,3,2));
fakeFolder.remoteModifier().setModTime("A/a1", someDate);
QVERIFY(fakeFolder.syncOnce());
QVERIFY(!fakeFolder.currentLocalState().find("A/a1"));
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a1.owncloud").lastModified(), someDate);
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QVERIFY(itemInstruction(completeSpy, "A/a1.owncloud", CSYNC_INSTRUCTION_NEW));
QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
@ -80,6 +83,7 @@ private slots:
QVERIFY(fakeFolder.syncOnce());
QVERIFY(!fakeFolder.currentLocalState().find("A/a1"));
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a1.owncloud").lastModified(), someDate);
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QVERIFY(completeSpy.isEmpty());
@ -90,6 +94,7 @@ private slots:
QVERIFY(fakeFolder.syncOnce());
QVERIFY(!fakeFolder.currentLocalState().find("A/a1"));
QVERIFY(fakeFolder.currentLocalState().find("A/a1.owncloud"));
QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a1.owncloud").lastModified(), someDate);
QVERIFY(fakeFolder.currentRemoteState().find("A/a1"));
QCOMPARE(dbRecord(fakeFolder, "A/a1.owncloud")._type, ItemTypeVirtualFile);
QVERIFY(completeSpy.isEmpty());