Skip to content

Honor --dry-run when staging files - #153

Open
piyushbag wants to merge 1 commit into
EpicGames:mainfrom
piyushbag:fix/stage-dry-run-no-persist
Open

Honor --dry-run when staging files#153
piyushbag wants to merge 1 commit into
EpicGames:mainfrom
piyushbag:fix/stage-dry-run-no-persist

Conversation

@piyushbag

Copy link
Copy Markdown

Summary

lore stage --dry-run computed staged state but still persisted the staged anchor, so a later real stage reported "No changes staged" and commit could pick up the preview state.

  • Guard staged-anchor persistence with globals.dry_run() in file/stage.rs and stage.rs.
  • Keep stage end/progress/revision events on dry-run so preview output is unchanged.

Fixes #125

Test plan

  • cargo +nightly fmt --all
  • cargo clippy -p lore-revision --all-targets -- -D warnings --no-deps
  • cargo test -p lore-revision --test stage stage_dry_run_no_persist

Evidence

$ cargo test -p lore-revision --test stage stage_dry_run_no_persist
running 1 test
test tests::stage_dry_run_no_persist ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

The test commits a baseline revision, modifies a tracked file, runs dry-run stage (no staged anchor persisted), then runs a real stage and verifies the staged anchor is written.

Skip persisting staged anchors during dry-run while still emitting
stage progress and revision events, matching commit and revert behavior.

Fixes EpicGames#125

Signed-off-by: Piyush Jagadish Bag <piyushbag4@gmail.com>
@piyushbag
piyushbag force-pushed the fix/stage-dry-run-no-persist branch from 51801b9 to f5db087 Compare July 31, 2026 00:37
@ajcarberry ajcarberry added the area:core Core library and its interfaces (lib, C API); revision, storage, transport, protocol internals label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Core library and its interfaces (lib, C API); revision, storage, transport, protocol internals

Development

Successfully merging this pull request may close these issues.

Bug: lore stage --dry-run persists the staged state (dry run is not dry)

2 participants