Discovery: fix TestSyncVirtualFiles::testExtraFilesLocalDehydrated on windows
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 31 Oct 2019 09:41:38 +0000 (10:41 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:02 +0000 (10:59 +0100)
On windows we do a test to know if we should change the case of the files,
but that conflict with the test that checks if the file was still there
when the filename is actually the same. Which can happen with virtual files
as they have two representation (the one with and without suffix).

src/libsync/discovery.cpp

index 5bd2ed006c7af3b363f9740bb6a42ae67bf8f816..7d2b4e59933fc7035e719b713ba809b56c609fff 100644 (file)
@@ -892,11 +892,12 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
         }
 
         // The old file must have been deleted.
-        if (QFile::exists(_discoveryData->_localDir + base._path)
+        if (QFile::exists(_discoveryData->_localDir + originalPath)
             // 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)) {
+                 && originalPath.compare(path._local, Qt::CaseInsensitive) == 0
+                 && originalPath != path._local)) {
             qCInfo(lcDisco) << "Not a move, base file still exists at" << originalPath;
             return false;
         }