@@ -349,7 +349,10 @@ void PropagateLocalRename::start()
349349 const auto targetFile = propagator ()->fullLocalPath (_item->_renameTarget );
350350 const auto originalFile = propagator ()->fullLocalPath (_item->_originalFile );
351351
352- const auto fileAlreadyMoved = (!FileSystem::fileExists (originalFile) || !FileSystem::fileExists (existingFile))&& FileSystem::fileExists (targetFile);
352+ const auto origExists = FileSystem::fileExists (originalFile);
353+ const auto existingExists = FileSystem::fileExists (existingFile);
354+ const auto targetExists = FileSystem::fileExists (targetFile);
355+ const auto fileAlreadyMoved = (!origExists || !existingExists) && targetExists;
353356 auto pinState = OCC ::PinState::Unspecified;
354357 if (!fileAlreadyMoved) {
355358 auto pinStateResult = vfs->pinState (propagator ()->adjustRenamedPath (_item->_file ));
@@ -361,9 +364,9 @@ void PropagateLocalRename::start()
361364 // if the file is a file underneath a moved dir, the _item->file is equal
362365 // to _item->renameTarget and the file is not moved as a result.
363366 qCDebug (lcPropagateLocalRename) << _item->_file << _item->_renameTarget << _item->_originalFile << previousNameInDb << (fileAlreadyMoved ? " original file has already moved" : " original file is still there" );
364- qCDebug (lcPropagateLocalRename ()) << (FileSystem::fileExists (originalFile) ? " original file exists" : " original file is missing" ) << originalFile << _item->_originalFile ;
365- qCDebug (lcPropagateLocalRename ()) << (FileSystem::fileExists (existingFile) ? " existing file exists" : " existing file is missing" ) << existingFile << previousNameInDb;
366- Q_ASSERT (FileSystem::fileExists ( propagator ()-> fullLocalPath (_item-> _originalFile )) || FileSystem::fileExists (existingFile) );
367+ qCDebug (lcPropagateLocalRename ()) << (origExists ? " original file exists" : " original file is missing" ) << originalFile << _item->_originalFile ;
368+ qCDebug (lcPropagateLocalRename ()) << (existingExists ? " existing file exists" : " existing file is missing" ) << existingFile << previousNameInDb;
369+ Q_ASSERT (origExists || existingExists );
367370 if (_item->_file != _item->_renameTarget ) {
368371 propagator ()->reportProgress (*_item, 0 );
369372 qCDebug (lcPropagateLocalRename) << " MOVE " << existingFile << " => " << targetFile;
0 commit comments