Discovery: Increase the MAX_DEPTH and show deep folder as ignored

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
This commit is contained in:
Olivier Goffart 2017-04-28 13:16:19 +02:00 committed by Markus Goetz
parent fbe812b9bc
commit 13705999f7
4 changed files with 12 additions and 3 deletions

View 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;

View 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

View 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) {

View 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;