SC-11: dry-run mode (--dry-run / -n) - #11
Merged
Merged
Conversation
Only Receiver needed dry-run awareness - Sender's planning work runs unconditionally regardless of dry-run. All 8 write call sites in Receiver (directory/symlink creation, ApplyAttributes for symlinks/ dirs/files, ApplyHardLinks, WriteFile) individually gated behind dry-run - a disclosed, deliberate divergence from real rsync's docs, since grsync has no cheap size+mtime shortcut to skip it the way real rsync's default mode does (pre-existing architectural choice from SC-3/SC-16, not something to invent here). New -i/--itemize-changes flag implementing real rsync's YXcstpoguax format, verified against the actual man page, scoped honestly to what grsync tracks (u/a/x always ., no checksum-gated c). Added an h code for hard-link secondaries beyond the ticket's explicit list, since SC-18 already computes that grouping and >f+++++++++ would otherwise misrepresent a linked file as an ordinary new one. Dry-run safety verified across all three transports. Itemize/verbose output works for local, SSH (new stderr passthrough in transport.Session), and daemon-GET - daemon-PUT has no channel back to the client once the handshake ends, disclosed explicitly (README + a one-time CLI notice) rather than silently broken or over-engineered. TestReceiver_DryRunMakesNoFilesystemChanges proves zero filesystem changes against a tree exercising all 8 write paths. Dry-run vs. real-run itemize output proven byte-identical at pipeline and CLI level. Clean on native Windows and cross-compiled Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only Receiver needed dry-run awareness - Sender's planning work runs unconditionally regardless of dry-run. All 8 write call sites in Receiver (directory/symlink creation, ApplyAttributes for symlinks/ dirs/files, ApplyHardLinks, WriteFile) individually gated behind dry-run - a disclosed, deliberate divergence from real rsync's docs, since grsync has no cheap size+mtime shortcut to skip it the way real rsync's default mode does (pre-existing architectural choice from SC-3/SC-16, not something to invent here).
New -i/--itemize-changes flag implementing real rsync's YXcstpoguax format, verified against the actual man page, scoped honestly to what grsync tracks (u/a/x always ., no checksum-gated c). Added an h code for hard-link secondaries beyond the ticket's explicit list, since SC-18 already computes that grouping and >f+++++++++ would otherwise misrepresent a linked file as an ordinary new one.
Dry-run safety verified across all three transports. Itemize/verbose output works for local, SSH (new stderr passthrough in transport.Session), and daemon-GET - daemon-PUT has no channel back to the client once the handshake ends, disclosed explicitly (README + a one-time CLI notice) rather than silently broken or over-engineered.
TestReceiver_DryRunMakesNoFilesystemChanges proves zero filesystem changes against a tree exercising all 8 write paths. Dry-run vs. real-run itemize output proven byte-identical at pipeline and CLI level.
Clean on native Windows and cross-compiled Linux.