fix(transaction): roll back what a refused rebase already changed - #296
Conversation
`roll_back_failed_rebase` skipped the whole rollback whenever the rebase never started, on the grounds that a pre-flight refusal autostashed nothing and the index was never loom's. That holds for the callers that only build a weave first, but not for `commit`, which makes its commit and empties the index before the rebase exists, nor for `absorb`, which makes its `fixup!` commits. Both left those commits stranded and their staging and working tree behind, with the state file deleted so `loom abort` had nothing to read. A recorded `reset_mixed_to` or `reset_hard_to` is exactly the mark of a caller that moved HEAD itself before the rebase, so it is what decides now. With neither, the shortcut stands: the index is the user's and replaying the saved patch over it would double their staging. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: If2e9e05c0031a4d1a48d01ce6117fcde71664c38
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughFailed rebase cleanup now distinguishes refusals before HEAD movement from failures that require a full rollback. Specifications and documentation define the rules. Regression tests verify restoration of commits, staged changes, working-tree content, and transaction state. ChangesFailed rebase rollback behavior
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
roll_back_failed_rebaseskipped the whole rollback whenever the rebase neverstarted, on the grounds that a pre-flight refusal autostashed nothing and the
index was never loom's. That holds for the callers that only build a weave
first, but not for
commit, which makes its commit and empties the indexbefore the rebase exists, nor for
absorb, which makes itsfixup!commits.Both left those commits stranded and their staging and working tree behind,
with the state file deleted so
loom aborthad nothing to read.A recorded
reset_mixed_toorreset_hard_tois exactly the mark of a callerthat moved HEAD itself before the rebase, so it is what decides now. With
neither, the shortcut stands: the index is the user's and replaying the saved
patch over it would double their staging.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Change-Id: If2e9e05c0031a4d1a48d01ce6117fcde71664c38
Summary by CodeRabbit