Skip to content

Commit

Permalink
Discovery: Increase the MAX_DEPTH and show deep folder as ignored
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ogoffart committed Apr 28, 2017
1 parent 3db8d3d commit 01913aa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion csync/src/csync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_INVIDUAL_TOO_DEEP
};

typedef enum csync_status_codes_e CSYNC_STATUS;
Expand Down
2 changes: 1 addition & 1 deletion csync/src/csync_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion csync/src/csync_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_INVIDUAL_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;
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_INVIDUAL_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;
Expand Down

0 comments on commit 01913aa

Please sign in to comment.