fix(finish): always clear merge state even when git abort reports no-op#111
Open
SAY-5 wants to merge 1 commit intogittower:mainfrom
Open
fix(finish): always clear merge state even when git abort reports no-op#111SAY-5 wants to merge 1 commit intogittower:mainfrom
SAY-5 wants to merge 1 commit intogittower:mainfrom
Conversation
handleAbort called git merge/rebase --abort first and bailed early on
error, so a common real-world sequence — conflict, manual resolve+
commit (bypassing --continue), then --abort — left merge.json on disk
after 'merge --abort' returned exit 128 ('MERGE_HEAD missing'). Every
subsequent 'feature finish' was permanently blocked until the user
deleted .git/gitflow/state/merge.json by hand.
Treat the abort error as informational, continue cleanup, and still
call mergestate.ClearMergeState so the repo is unblocked. A warning
is printed to stderr when git had nothing to abort so operators can
see it. The checkout-original-branch step only fails the whole
operation when abort itself succeeded (the previously exercised
happy path).
Refs gittower/git-flow-next issue 110.
Signed-off-by: SAY-5 <say.apm35@gmail.com>
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.
Fixes #110.
Problem
handleAbortcalledgit merge --abort(orrebase --abort) first and bailed early on error. The common sequence — feature finish → merge conflict → user manually resolves and commits (bypassing--continue) →--abort— then leavesmerge.jsonon disk becausemerge --abortexits 128 (MERGE_HEADmissing) andClearMergeStateis never reached. Every subsequentfeature finishis permanently blocked until the user deletes.git/gitflow/state/merge.jsonby hand.Fix
Treat the abort error as informational, continue cleanup, and always reach
mergestate.ClearMergeStateso the repo is unblocked. Warn to stderr when git had nothing to abort so operators still see it. The checkout-original-branch step only fails the whole operation when abort itself succeeded (preserving the happy-path behavior).Test
go buildclean. The integration suite intest/cmdhas a pre-existing hang on this machine (confirmed by running it against a stash of my change — same timeout), but the code path is covered intest/internal/git/worktree_test.gowhich continues to pass.