mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
SyncEngine: _hasNoneFiles should be set when there are INSTRUCTION_UPDATE_METADATA
This commit is contained in:
parent
1da398e6c6
commit
800b9cf167
2 changed files with 44 additions and 1 deletions
|
@ -555,7 +555,7 @@ int SyncEngine::treewalkFile(csync_file_stat_t *file, csync_file_stat_t *other,
|
|||
switch (file->instruction) {
|
||||
case CSYNC_INSTRUCTION_NONE: {
|
||||
// Any files that are instruction NONE?
|
||||
if (!isDirectory && (!other || other->instruction == CSYNC_INSTRUCTION_NONE)) {
|
||||
if (!isDirectory && (!other || other->instruction == CSYNC_INSTRUCTION_NONE || other->instruction == CSYNC_INSTRUCTION_UPDATE_METADATA)) {
|
||||
_hasNoneFiles = true;
|
||||
}
|
||||
// Put none-instruction conflict files into the syncfileitem list
|
||||
|
@ -614,6 +614,10 @@ int SyncEngine::treewalkFile(csync_file_stat_t *file, csync_file_stat_t *other,
|
|||
_journal->updateLocalMetadata(item->_file, item->_modtime, item->_size, item->_inode);
|
||||
}
|
||||
|
||||
if (!other || other->instruction == CSYNC_INSTRUCTION_NONE || other->instruction == CSYNC_INSTRUCTION_UPDATE_METADATA) {
|
||||
_hasNoneFiles = true;
|
||||
}
|
||||
|
||||
// Technically we're done with this item.
|
||||
return re;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
|
||||
using namespace OCC;
|
||||
|
||||
|
||||
static void changeAllFileId(FileInfo &info) {
|
||||
info.fileId = generateFileId();
|
||||
if (!info.isDir)
|
||||
return;
|
||||
info.etag = generateEtag();
|
||||
for (auto it = info.children.begin(); it != info.children.end(); ++it) {
|
||||
changeAllFileId(*it);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This test ensure that the SyncEngine::aboutToRemoveAllFiles is correctly called and that when
|
||||
* we the user choose to remove all files SyncJournalDb::clearFileTable makes works as expected
|
||||
|
@ -112,6 +123,34 @@ private slots:
|
|||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
QCOMPARE(fakeFolder.currentLocalState().children.count(), 0);
|
||||
}
|
||||
|
||||
void testNotDeleteMetaDataChange() {
|
||||
/**
|
||||
* This test make sure that we don't popup a file deleted message if all the metadata have
|
||||
* been updated (for example when the server is upgraded or something)
|
||||
**/
|
||||
|
||||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
||||
// We never remove all files.
|
||||
QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles,
|
||||
[&] { QVERIFY(false); });
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
|
||||
for (const auto &s : fakeFolder.currentRemoteState().children.keys())
|
||||
fakeFolder.syncJournal().avoidRenamesOnNextSync(s); // clears all the fileid and inodes.
|
||||
fakeFolder.localModifier().remove("A/a1");
|
||||
auto expectedState = fakeFolder.currentLocalState();
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
QCOMPARE(fakeFolder.currentLocalState(), expectedState);
|
||||
QCOMPARE(fakeFolder.currentRemoteState(), expectedState);
|
||||
|
||||
fakeFolder.remoteModifier().remove("B/b1");
|
||||
changeAllFileId(fakeFolder.remoteModifier());
|
||||
expectedState = fakeFolder.currentRemoteState();
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
QCOMPARE(fakeFolder.currentLocalState(), expectedState);
|
||||
QCOMPARE(fakeFolder.currentRemoteState(), expectedState);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_GUILESS_MAIN(TestAllFilesDeleted)
|
||||
|
|
Loading…
Reference in a new issue