Skip to content

fix: duplicate error output and add --abort flag to sync#34

Merged
javoire merged 2 commits intomainfrom
fix/divergence-and-stale-info
Dec 9, 2025
Merged

fix: duplicate error output and add --abort flag to sync#34
javoire merged 2 commits intomainfrom
fix/divergence-and-stale-info

Conversation

@javoire
Copy link
Copy Markdown
Owner

@javoire javoire commented Dec 9, 2025

Problem

  1. Duplicate error output: When a rebase conflict occurs during stack sync, the git error message appears twice - once in the user-facing instructions and again as the raw error at the end.

  2. Missing abort option: There was no easy way to abort an interrupted sync; users had to manually run git rebase --abort and clean up state.

Solution

Fixed duplicate error output

  • Wrapped the rebase conflict error with errAlreadyPrinted sentinel error to prevent the Run function from printing it a second time

Added --abort flag

  • Added --abort flag to cleanly abort interrupted syncs
  • Implements complete cleanup: aborts rebase, restores stashed changes, returns to original branch, and cleans up state
  • Saves sync state (original branch) for all syncs, not just when stashing, so abort works even with clean working tree

Improved error messages

  • Updated conflict resolution instructions to mention stack sync --abort as an option
  • Updated stash note to mention both --resume and --abort will restore changes

Testing

  • Verified abort works with both clean and dirty working trees
  • Confirmed duplicate error output is eliminated

- Wrap rebase conflict error with errAlreadyPrinted to prevent duplicate output
- Add --abort flag to abort interrupted syncs and clean up state
- Save sync state (original branch) for all syncs, not just when stashing
- Update conflict resolution instructions to mention --abort option
- Add SetConfig expectations for saving original branch state
- Add UnsetConfig expectations for cleanup after successful sync
- Add comprehensive tests for --abort functionality covering:
  - Abort with stashed changes
  - Abort without stashed changes
  - Abort when no rebase is in progress
  - Error when no interrupted sync exists
@javoire javoire merged commit 933f8e9 into main Dec 9, 2025
1 check passed
@javoire javoire deleted the fix/divergence-and-stale-info branch December 9, 2025 20:13
@javoire
Copy link
Copy Markdown
Owner Author

javoire commented Dec 9, 2025

🎉 This PR is included in version 1.3.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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