diff --git a/RSYNC_COMPAT.md b/RSYNC_COMPAT.md index cf03c4e..52ba996 100644 --- a/RSYNC_COMPAT.md +++ b/RSYNC_COMPAT.md @@ -102,7 +102,7 @@ This document maps rsync's full feature set to FastSync's current implementation |------|-------------------|-----------------|-------| | `--delete` | Delete extraneous files from dest | ✅ Implemented | `use_delete` config field | | `--delete-before` | Delete before transfer | ❌ Not Implemented | Removed because it had no effect | -| `--delete-during` | Delete during transfer | ❌ Not Implemented | | +| `--del`, `--delete-during` | Delete during transfer | ❌ Not Implemented | Both flags are recognized but rejected; delete timing is not implemented | | `--delete-delay` | Find deletions during, delete after | ❌ Not Implemented | | | `--delete-after` | Delete after transfer | ❌ Not Implemented | Removed because it had no effect | | `--delete-excluded` | Also delete excluded files | ❌ Not Implemented | Removed because it had no effect | diff --git a/src/client/client_cli.c b/src/client/client_cli.c index de4b859..4caf6fb 100644 --- a/src/client/client_cli.c +++ b/src/client/client_cli.c @@ -387,6 +387,7 @@ static const OptionEntry OPTION_TABLE[] = { {"--chmod", NULL, OPT_STRING, offsetof(Config, chmod_spec)}, {"--dirs", "--old-dirs", OPT_UNSUPPORTED, 0}, {"--old-d", NULL, OPT_UNSUPPORTED, 0}, + {"--delete-during", "--del", OPT_UNSUPPORTED, 0}, {"--source-dir", NULL, OPT_STRING, offsetof(Config, send_directory)}, {"--dest-dir", NULL, OPT_STRING, offsetof(Config, receive_root_directory)}, @@ -520,12 +521,14 @@ 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: directory-only transfer is not implemented; refusing to ignore option", - option_name); + case OPT_UNSUPPORTED: { + const char* reason = "directory-only transfer is not implemented"; + if (strcmp(entry->name, "--delete-during") == 0) + reason = "delete-during is not implemented"; + log_message(LOG_LEVEL_ERROR, "%s: %s; refusing to ignore option", option_name, reason); return -1; } + } return -1; } diff --git a/src/client/usage.c b/src/client/usage.c index 35116f7..3c49e2b 100644 --- a/src/client/usage.c +++ b/src/client/usage.c @@ -27,6 +27,7 @@ void print_usage(void) { printf(" --ignore-existing Skip files that already exist on receiver\n"); printf( " --dirs, --old-dirs, --old-d Transfer directories without recursing (not implemented)\n"); + printf(" --del Alias for --delete-during (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 7c631ad..16e65c8 100644 --- a/tests/test_client_cli.c +++ b/tests/test_client_cli.c @@ -574,6 +574,22 @@ static void test_parse_args_rejects_dirs_aliases() { } } +/* --del is recognized as the rsync alias, but its timing mode is not implemented. */ +static void test_parse_args_delete_during_alias_unimplemented() { + static const char* const options[] = {"--del", "--delete-during"}; + + 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); + EXPECT_FALSE(cfg->use_delete); + 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[] = {"--silent", @@ -1110,6 +1126,7 @@ void test_client_cli() { test_parse_args_rejects_invalid_max_alloc(); test_parse_args_unknown_option(); test_parse_args_rejects_dirs_aliases(); + test_parse_args_delete_during_alias_unimplemented(); test_parse_args_rejects_unimplemented_options(); test_parse_args_quiet(); test_parse_args_human_readable();