Discovery: Increase the MAX_DEPTH and show deep folder as ignored
authorOlivier Goffart <ogoffart@woboq.com>
Fri, 28 Apr 2017 11:16:19 +0000 (13:16 +0200)
committerMarkus Goetz <markus@woboq.com>
Mon, 8 May 2017 09:29:51 +0000 (11:29 +0200)
Before this patch, to deep folder would just be ignored, without any feedback.
This patch makes it so deep folder are properly shown as ignored in the UI.

Also increase the MAX_DEPTH

Issue: #1067

csync/src/csync.h
csync/src/csync_private.h
csync/src/csync_update.c
src/libsync/syncengine.cpp

index 7703016972780c7633c4e1afbf9897279b36ff41..65b40c97e967cdf2287c59b5127fd9113bc14105 100644 (file)
@@ -99,7 +99,8 @@ enum csync_status_codes_e {
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN,
     CSYNC_STATUS_INVALID_CHARACTERS,
     CSYNC_STATUS_INDIVIDUAL_STAT_FAILED,
-    CSYNC_STATUS_FORBIDDEN
+    CSYNC_STATUS_FORBIDDEN,
+    CSYNC_STATUS_INDIVIDUAL_TOO_DEEP
 };
 
 typedef enum csync_status_codes_e CSYNC_STATUS;
index 48875d20e866383549aa40a69b149a1ea042b152..a10b09f6f3ad547b5477888538fcce773ee27180 100644 (file)
@@ -58,7 +58,7 @@
 /**
  * How deep to scan directories.
  */
-#define MAX_DEPTH 50
+#define MAX_DEPTH 100
 
 #define CSYNC_STATUS_INIT 1 << 0
 #define CSYNC_STATUS_UPDATE 1 << 1
index 66c8e965c4c903d092518a8c2b4a2a4110b7ed4a..2253783ced6462c83b374595a198e003eaad40b3 100644 (file)
@@ -643,6 +643,11 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
   int rc = 0;
   int res = 0;
 
+  if (!depth) {
+    mark_current_item_ignored(ctx, previous_fs, CSYNC_STATUS_INDIVIDUAL_TOO_DEEP);
+    goto done;
+  }
+
   bool do_read_from_db = (ctx->current == REMOTE_REPLICA && ctx->remote.read_from_db);
 
   read_from_db = ctx->remote.read_from_db;
@@ -798,7 +803,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
       goto error;
     }
 
-    if (flag == CSYNC_FTW_FLAG_DIR && depth && rc == 0
+    if (flag == CSYNC_FTW_FLAG_DIR && rc == 0
         && (!ctx->current_fs || ctx->current_fs->instruction != CSYNC_INSTRUCTION_IGNORE)) {
       rc = csync_ftw(ctx, filename, fn, depth - 1);
       if (rc < 0) {
index e3197b98eed74310450d2e0f4357985589d8ff1b..940ae4f8f304310ac62a6838019ebafcca42e423 100644 (file)
@@ -478,6 +478,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN:
         item->_errorString = tr("File/Folder is ignored because it's hidden.");
         break;
+    case CSYNC_STATUS_INDIVIDUAL_TOO_DEEP:
+        item->_errorString = tr("Folder hierarchy is too deep");
+        break;
     case CYSNC_STATUS_FILE_LOCKED_OR_OPEN:
         item->_errorString = QLatin1String("File locked"); // don't translate, internal use!
         break;