New discovery algorithm: Fix directory deletion

TestAllFilesDeleted passes
This commit is contained in:
Olivier Goffart 2018-07-17 10:09:57 +02:00 committed by Kevin Ottens
parent d54e00488a
commit 22d989e272
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 7 additions and 10 deletions

View file

@ -85,6 +85,8 @@ public:
void start();
void abort();
SyncFileItemPtr _dirItem;
private:
struct PathTuple
{
@ -121,7 +123,6 @@ private:
QPointer<DiscoverServerJob> _serverJob;
std::deque<ProcessDirectoryJob *> _queuedJobs;
QVector<ProcessDirectoryJob *> _runningJobs;
SyncFileItemPtr _dirItem;
QueryMode _queryServer;
QueryMode _queryLocal;
DiscoveryPhase *_discoveryData;

View file

@ -925,7 +925,9 @@ void SyncEngine::slotStartDiscovery()
_discoveryPhase.data(), this);
// FIXME! this sucks
auto runQueuedJob = [this](ProcessDirectoryJob *job, const auto &runQueuedJob) -> void {
connect(job, &ProcessDirectoryJob::finished, this, [this, runQueuedJob] {
connect(job, &ProcessDirectoryJob::finished, this, [this, job, runQueuedJob] {
if (job->_dirItem)
job->itemDiscovered(job->_dirItem);
sender()->deleteLater();
if (!_discoveryPhase->_queuedDeletedDirectories.isEmpty()) {
auto job = qobject_cast<ProcessDirectoryJob *>(_discoveryPhase->_queuedDeletedDirectories.take(_discoveryPhase->_queuedDeletedDirectories.firstKey()).data());
@ -1012,18 +1014,11 @@ void SyncEngine::slotDiscoveryJobFinished()
// qCInfo(lcEngine) << "Permissions of the root folder: " << _csync_ctx->remote.root_perms.toString();
/*
// Adjust the paths for the renames.
for (const auto &syncItem : qAsConst(syncItems)) {
syncItem->_file = adjustRenamedPath(syncItem->_file);
}
ConfigFile cfgFile;
if (!_hasNoneFiles && _hasRemoveFile && cfgFile.promptDeleteFiles()) {
qCInfo(lcEngine) << "All the files are going to be changed, asking the user";
bool cancel = false;
emit aboutToRemoveAllFiles(syncItems.first()->_direction, &cancel);
emit aboutToRemoveAllFiles(_syncItems.first()->_direction, &cancel);
if (cancel) {
qCInfo(lcEngine) << "User aborted sync";
finalize(false);
@ -1031,6 +1026,7 @@ void SyncEngine::slotDiscoveryJobFinished()
}
}
/*
auto databaseFingerprint = _journal->dataFingerprint();
// If databaseFingerprint is empty, this means that there was no information in the database
// (for example, upgrading from a previous version, or first sync, or server not supporting fingerprint)