Skip to content

Implement --update parity for local copies - #904

Merged
oferchen merged 2 commits into
masterfrom
implement-missing-components-for-rsync
Oct 22, 2025
Merged

oferchen merged 2 commits into
masterfrom
implement-missing-components-for-rsync

Conversation

@oferchen

@oferchen oferchen commented Oct 22, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • add --update/-u to the CLI help, parser, and supported options list so the flag can be requested
  • plumb the new update flag through the client configuration, event reporting, and summaries
  • teach the local copy engine to skip newer destination files and track the associated counters and events
  • document the additional CLI capability in docs/feature_matrix.md

Testing

  • cargo test

Red → Green count: n/a (no goldens affected)


@oferchen
oferchen merged commit c34d116 into master Oct 22, 2025
@oferchen
oferchen deleted the implement-missing-components-for-rsync branch October 22, 2025 20:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3687 to +3699
if context.update_enabled() {
if let Some(existing) = destination_state.as_ref() {
if destination_is_newer(metadata, existing) {
context.summary_mut().record_regular_file_skipped_newer();
context.record(LocalCopyRecord::new(
record_path.clone(),
LocalCopyAction::SkippedNewerDestination,
0,
Duration::default(),
Some(LocalCopyMetadata::from_metadata(metadata)),
));
return Ok(());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply --update only to regular destination files

The new --update handling skips a copy whenever the destination entry has a newer mtime, but it does so before verifying that the existing entry is the same kind of object as the source. If a regular file is copied over a newer symbolic link, device, or other non-regular entry, these blocks short‑circuit and leave the differing destination untouched. Upstream rsync still replaces non‑matching types even when --update is set, so the current logic will silently keep stale symlinks or devices whenever they happen to have a newer timestamp. Consider checking existing.file_type().is_file() (or otherwise ensuring the types match) before honoring --update; only identical file types should be skipped due to the flag.

Useful? React with 👍 / 👎.

Comment on lines +3755 to +3767
if context.update_enabled() {
if let Some(existing) = existing_metadata.as_ref() {
if destination_is_newer(metadata, existing) {
context.summary_mut().record_regular_file_skipped_newer();
context.hard_links.record(metadata, destination);
context.record(LocalCopyRecord::new(
record_path.clone(),
LocalCopyAction::SkippedNewerDestination,
0,
Duration::default(),
Some(LocalCopyMetadata::from_metadata(metadata)),
));
return Ok(());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply --update only to regular destination files

The same unconditional --update skip appears in the non–dry run path. If the destination is a symlink or other non-regular entry that is newer than the source, the new block returns early and never replaces it, even though rsync would normally overwrite type mismatches regardless of timestamps. This can leave a different object in place when --update is supplied. Guard the destination_is_newer check with a type comparison so that only regular files (or matching types) are skipped.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant