From c72b6fb8e6c73d90f4be0bd53089e42db562044d Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 15 Jul 2015 15:01:27 +0200 Subject: [PATCH] csync_update: Reorg the code a bit to make it easier to read and understand --- csync/src/csync_update.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 3fd98eb41..cf73f3185 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -166,7 +166,17 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, /* Check if file is excluded */ excluded = csync_excluded(ctx, path,type); - if (excluded != CSYNC_NOT_EXCLUDED) { + if( excluded == CSYNC_NOT_EXCLUDED ) { + /* Even if it is not excluded by a pattern, maybe it is to be ignored + * because it's a hidden file that should not be synced. + * This code should probably be in csync_exclude, but it does not have the fs parameter. + * Keep it here for now */ + if (ctx->ignore_hidden_files && (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN)) { + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path); + excluded = CSYNC_FILE_EXCLUDE_HIDDEN; + } + } else { + /* File is ignored because it's matched by a user- or system exclude pattern. */ CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded (%d)", path, excluded); if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { return 1; @@ -174,13 +184,6 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) { return 1; } - } else { - /* This code should probably be in csync_exclude, but it does not have the fs parameter. - Keep it here for now */ - if (ctx->ignore_hidden_files && (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN)) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path); - excluded = CSYNC_FILE_EXCLUDE_HIDDEN; - } } if (ctx->current == REMOTE_REPLICA && ctx->callbacks.checkSelectiveSyncBlackListHook) {