fix(cli): --partial-dir implies --partial (rsync parity)
rsync 3.4.1 resolves --partial-dir after option parsing and sets keep_partial, so --partial-dir=DIR alone retains an interrupted transfer's partial file. FastSync only used the partial dir when --partial was also given, silently discarding it otherwise. Set Config->partial in cli_finalize_config whenever partial_dir is set. Following rsync, an explicit --no-partial does NOT win (verified on rsync 3.4.1 in either option order); --inplace is guarded because it writes the destination in place with no partial staging. Tests: CLI unit coverage for the implication/precedence/inplace guard, and a deterministic integration case that blocks the final install (non-empty directory at the destination) and asserts the staged partial survives under --partial-dir alone.
This commit is contained in:
@@ -2612,6 +2612,15 @@ static int cli_finalize_config(Config* config, bool verbose, bool no_delta, bool
|
||||
if (config->use_delete && !config->delete_before && !config->delete_during &&
|
||||
!config->delete_delay && !config->delete_after)
|
||||
config->delete_during = true;
|
||||
/* rsync parity: --partial-dir=DIR chooses where an interrupted transfer's
|
||||
partial file is kept, so it implies --partial. rsync applies the
|
||||
implication after option parsing, so it wins over an explicit --no-partial
|
||||
regardless of the order the two options appear in (verified on rsync
|
||||
3.4.1). --inplace is the exception: the destination file is written in
|
||||
place with no partial/temp staging, so the partial machinery is bypassed
|
||||
and the implication is skipped to leave --inplace behavior untouched. */
|
||||
if (config->partial_dir && !config->inplace)
|
||||
config->partial = true;
|
||||
if (config->compress_choice) {
|
||||
int algo = compression_algo_from_name(config->compress_choice);
|
||||
if (algo >= 0) {
|
||||
|
||||
+1
-1
@@ -288,7 +288,7 @@ void print_usage(void) {
|
||||
printf(" --log-file <path>, --log-file=<path> Write log messages to file\n");
|
||||
printf(" --stderr=MODE Route logging to stderr: errors or all\n");
|
||||
printf(" --partial Keep partial files on interrupted transfer\n");
|
||||
printf(" --partial-dir <dir> Directory for partial files\n");
|
||||
printf(" --partial-dir <dir> Directory for partial files (implies --partial)\n");
|
||||
printf(" -T, --temp-dir <dir> Scratch dir for temp files before atomic install.\n");
|
||||
printf(" Confined to the receive root: a relative dir resolves below\n");
|
||||
printf(" it and an absolute/traversal dir is rejected. The dir must\n");
|
||||
|
||||
Reference in New Issue
Block a user