diff --git a/README.md b/README.md index fdbd9f3..be6fbc7 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,9 @@ replacement for every rsync feature or protocol mode. - Sparse-file handling does not yet preserve all holes correctly. - `--partial`, `--partial-dir`, `--append`, and `--append-verify` are not yet full rsync-style resumable transfers. +- `--dirs` is not implemented. Its compatibility aliases `--old-dirs` and + `--old-d` are recognized but rejected explicitly rather than silently using + FastSync's recursive directory behavior. - Several rsync short options currently have FastSync-specific meanings. Do not assume every short option is interchangeable yet. diff --git a/RSYNC_COMPAT.md b/RSYNC_COMPAT.md index 4b236ec..8484928 100644 --- a/RSYNC_COMPAT.md +++ b/RSYNC_COMPAT.md @@ -71,7 +71,7 @@ This document maps rsync's full feature set to FastSync's current implementation | `-r`, `--recursive` | Recurse into directories | ✅ Implemented | Default behavior | | `-R`, `--relative` | Use relative path names | ❌ Not Implemented | Removed because it had no effect | | `--no-implied-dirs` | Don't send implied dirs with -R | ❌ Not Implemented | | -| `-d`, `--dirs` | Transfer dirs without recursing | ❌ Not Implemented | | +| `-d`, `--dirs`, `--old-dirs`, `--old-d` | Transfer dirs without recursing | ❌ Not Implemented | The aliases are recognized and rejected explicitly; they depend on the unimplemented `--dirs` behavior | | `--mkpath` | Create missing path components | ❌ Not Implemented | | ## 5. Transfer Modifications diff --git a/src/client/client_cli.c b/src/client/client_cli.c index 191cc07..0de3a4f 100644 --- a/src/client/client_cli.c +++ b/src/client/client_cli.c @@ -125,6 +125,7 @@ typedef enum { OPT_POS_INT, OPT_NONNEG_INT, OPT_ULL, + OPT_UNSUPPORTED, } OptKind; typedef struct { @@ -153,6 +154,8 @@ static const OptionEntry OPTION_TABLE[] = { {"--sparse", "-S", OPT_FLAG, offsetof(Config, preserve_sparse)}, {"--inplace", NULL, OPT_FLAG, offsetof(Config, inplace)}, {"--checksum", NULL, OPT_FLAG, offsetof(Config, checksum)}, + {"--dirs", "--old-dirs", OPT_UNSUPPORTED, 0}, + {"--old-d", NULL, OPT_UNSUPPORTED, 0}, {"--source-dir", NULL, OPT_STRING, offsetof(Config, send_directory)}, {"--dest-dir", NULL, OPT_STRING, offsetof(Config, receive_root_directory)}, @@ -203,6 +206,11 @@ static int apply_table_option(Config* config, const OptionEntry* entry, const ch *(unsigned long long*)field = v; return 0; } + case OPT_UNSUPPORTED: + log_message(LOG_LEVEL_ERROR, + "%s requires --dirs, which is not implemented; refusing to ignore option", + entry->name); + return -1; } return -1; } diff --git a/src/client/usage.c b/src/client/usage.c index 2f800af..4689df9 100644 --- a/src/client/usage.c +++ b/src/client/usage.c @@ -21,6 +21,8 @@ void print_usage(void) { printf(" -p SSH port (default: 22)\n"); printf(" --progress Show transfer progress\n"); printf(" --delete Delete files on receiver not in source\n"); + printf( + " --dirs, --old-dirs, --old-d Transfer directories without recursing (not implemented)\n"); printf(" --exclude Exclude files matching pattern\n"); printf(" --include Only include files matching pattern\n"); printf(" --exclude-from Read exclude patterns from file\n"); diff --git a/tests/test_client_cli.c b/tests/test_client_cli.c index 656fd40..d998a3e 100644 --- a/tests/test_client_cli.c +++ b/tests/test_client_cli.c @@ -260,6 +260,21 @@ static void test_parse_args_unknown_option() { config_delete(cfg); } +/* Directory aliases require the not-yet-implemented --dirs behavior. */ +static void test_parse_args_rejects_dirs_aliases() { + static const char* const options[] = {"--dirs", "--old-dirs", "--old-d"}; + + for (size_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) { + Config* cfg = config_create(); + char* argv[] = {"fastsync", (char*)options[i], "/src", "/dst"}; + int positional_args[2]; + int positional_count = 0; + + EXPECT_EQ_INT(parse_args(cfg, 4, argv, positional_args, &positional_count), -1); + config_delete(cfg); + } +} + /* Parsed-but-unimplemented options must fail instead of being silently accepted. */ static void test_parse_args_rejects_unimplemented_options() { static const char* const options[] = {"-q", @@ -358,6 +373,7 @@ void test_client_cli() { test_parse_args_invalid_compression_level(); test_parse_args_valid_compression_level(); test_parse_args_unknown_option(); + test_parse_args_rejects_dirs_aliases(); test_parse_args_rejects_unimplemented_options(); test_parse_args_archive(); }