SocketApi: Fix returning ignore for the root item all the time
authorOlivier Goffart <ogoffart@woboq.com>
Tue, 27 Oct 2015 15:06:38 +0000 (16:06 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Tue, 27 Oct 2015 15:06:38 +0000 (16:06 +0100)
src/gui/folder.cpp
src/gui/socketapi.cpp

index 5d3db6afe67db25a28e979c67795e7d18ccab955..d66b8d78ac0b135582237f4c926becf019e7f564 100644 (file)
@@ -703,16 +703,16 @@ void Folder::removeFromSettings() const
 
 bool Folder::isFileExcludedAbsolute(const QString& fullPath) const
 {
+    if (!fullPath.startsWith(path())) {
+        // Mark paths we're not responsible for as excluded...
+        return true;
+    }
+
     QString myFullPath = fullPath;
     if (myFullPath.endsWith(QLatin1Char('/'))) {
         myFullPath.chop(1);
     }
 
-    if (!myFullPath.startsWith(path())) {
-        // Mark paths we're not responsible for as excluded...
-        return true;
-    }
-
     QString relativePath = myFullPath.mid(path().size());
     auto excl = ExcludedFiles::instance().isExcluded(myFullPath, relativePath, _definition.ignoreHiddenFiles);
     return excl != CSYNC_NOT_EXCLUDED;
index 75190f710566f00f8bc94a8faf1f609a3e47dd3f..a3ffa93275f205cf3c44306a2ab5cf012c3cfd83 100644 (file)
@@ -542,8 +542,8 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
     QString fileName = systemFileName.normalized(QString::NormalizationForm_C);
     QString fileNameSlash = fileName;
 
-    if( fileName != QLatin1String("/") && !fileName.isEmpty() ) {
-        file = folder->path() + fileName;
+    if(fileName != QLatin1String("/") && !fileName.isEmpty()) {
+        file += fileName;
     }
 
     if( fileName.endsWith(QLatin1Char('/')) ) {
@@ -576,7 +576,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
     }
 
     // Is it excluded?
-    if( folder->isFileExcludedAbsolute(file) ) {
+    if( folder->isFileExcludedRelative(fileName) ) {
         return SyncFileStatus(SyncFileStatus::STATUS_IGNORE);
     }
 
@@ -591,7 +591,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
     SyncJournalFileRecord rec = dbFileRecord_capi(folder, fileName );
 
     if (folder->estimateState(fileName, type, &status)) {
-        qDebug() << Q_FUNC_INFO << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString();
+        qDebug() << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString();
     } else if (fileName == "") {
         // sync folder itself
         switch (folder->syncResult().status()) {
@@ -621,7 +621,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
         if (rec.isValid()) {
             status.set(SyncFileStatus::STATUS_SYNC);
         } else {
-            qDebug() << Q_FUNC_INFO << "Could not determine state for folder" << fileName << "will set STATUS_NEW";
+            qDebug() << "Could not determine state for folder" << fileName << "will set STATUS_NEW";
             status.set(SyncFileStatus::STATUS_NEW);
         }
     } else if (type == CSYNC_FTW_TYPE_FILE) {
@@ -636,7 +636,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
                 }
             }
         } else {
-            qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW";
+            qDebug() << "Could not determine state for file" << fileName << "will set STATUS_NEW";
             status.set(SyncFileStatus::STATUS_NEW);
         }
     }