// Directories and virtual files don't need size/mtime equality
|| localEntry.isDirectory || localEntry.isVirtualFile);
+ auto originalPath = QString::fromUtf8(base._path);
if (isMove) {
- // The old file must have been deleted.
- isMove = !QFile::exists(_discoveryData->_localDir + base._path);
+ // The old file must have been deleted.
+ isMove = !QFile::exists(_discoveryData->_localDir + base._path)
+ // Exception: If the rename changes case only (like "foo" -> "Foo") the
+ // old filename might still point to the same file.
+ || (Utility::fsCasePreserving()
+ && originalPath.compare(path._local, Qt::CaseInsensitive) == 0);
}
// Verify the checksum where possible
isMove = item->_checksumHeader == base._checksumHeader;
}
}
- auto originalPath = QString::fromUtf8(base._path);
if (isMove && _discoveryData->isRenamed(originalPath))
isMove = false;
QCOMPARE(counter.nDELETE, 0);
}
+ // These renames can be troublesome on windows
+ void testRenameCaseOnly()
+ {
+ FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
+ auto &local = fakeFolder.localModifier();
+ auto &remote = fakeFolder.remoteModifier();
+
+ OperationCounter counter;
+ fakeFolder.setServerOverride(counter.functor());
+
+ local.rename("A/a1", "A/A1");
+ remote.rename("A/a2", "A/A2");
+
+ QVERIFY(fakeFolder.syncOnce());
+ QCOMPARE(fakeFolder.currentLocalState(), remote);
+ QCOMPARE(printDbData(fakeFolder.dbState()), printDbData(fakeFolder.currentRemoteState()));
+ QCOMPARE(counter.nGET, 0);
+ QCOMPARE(counter.nPUT, 0);
+ QCOMPARE(counter.nMOVE, 1);
+ QCOMPARE(counter.nDELETE, 0);
+ }
+
// Check interaction of moves with file type changes
void testMoveAndTypeChange()
{