diff --git a/csync/src/csync.h b/csync/src/csync.h index d710c170c..97eb9811f 100644 --- a/csync/src/csync.h +++ b/csync/src/csync.h @@ -103,7 +103,8 @@ enum csync_status_codes_e { CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST, CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS, CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME, - CYSNC_STATUS_FILE_LOCKED_OR_OPEN + CYSNC_STATUS_FILE_LOCKED_OR_OPEN, + CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN }; typedef enum csync_status_codes_e CSYNC_STATUS; diff --git a/csync/src/csync_exclude.h b/csync/src/csync_exclude.h index 329d95763..0bdbb6f74 100644 --- a/csync/src/csync_exclude.h +++ b/csync/src/csync_exclude.h @@ -27,7 +27,8 @@ enum csync_exclude_type_e { CSYNC_FILE_EXCLUDE_AND_REMOVE, CSYNC_FILE_EXCLUDE_LIST, CSYNC_FILE_EXCLUDE_INVALID_CHAR, - CSYNC_FILE_EXCLUDE_LONG_FILENAME + CSYNC_FILE_EXCLUDE_LONG_FILENAME, + CSYNC_FILE_EXCLUDE_HIDDEN }; typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE; diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 4274467b5..2db4b28c4 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -163,29 +163,29 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, len = strlen(path); - /* This code should probably be in csync_exclude, but it does not have the fs parameter. - Keep it here for now and TODO also find out if we want this for Windows - https://github.com/owncloud/mirall/issues/2086 */ - if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path); - return 0; - } - /* Check if file is excluded */ excluded = csync_excluded(ctx, path,type); if (excluded != CSYNC_NOT_EXCLUDED) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded (%d)", path, excluded); - if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { - return 1; - } - if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) { - return 1; - } + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded (%d)", path, excluded); + if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) { + return 1; + } + if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) { + return 1; + } - if (ctx->current_fs) { - ctx->current_fs->has_ignored_files = true; - } + if (ctx->current_fs) { + ctx->current_fs->has_ignored_files = true; + } + } else { + + /* This code should probably be in csync_exclude, but it does not have the fs parameter. + Keep it here for now */ + if (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) { @@ -208,9 +208,9 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, st->child_modified = 0; st->has_ignored_files = 0; - /* check hardlink count */ + /* FIXME: Under which conditions are the following two ifs true and the code + * is executed? */ if (type == CSYNC_FTW_TYPE_FILE ) { - if (fs->mtime == 0) { CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - mtime is zero!", path); @@ -424,6 +424,8 @@ out: st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS; /* File contains invalid characters. */ } else if (excluded == CSYNC_FILE_EXCLUDE_LONG_FILENAME) { st->error_status = CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME; /* File name is too long. */ + } else if (excluded == CSYNC_FILE_EXCLUDE_HIDDEN ) { + st->error_status = CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN; } } if (st->instruction != CSYNC_INSTRUCTION_NONE && st->instruction != CSYNC_INSTRUCTION_IGNORE diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index dba2a47d2..2ceb6c15c 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -376,6 +376,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote ) case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME: item->_errorString = tr("Filename is too long."); break; + case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN: + item->_errorString = tr("File is ignored because it's hidden."); + break; case CYSNC_STATUS_FILE_LOCKED_OR_OPEN: item->_errorString = QLatin1String("File locked"); // don't translate, internal use! break;