From fabc14d7e5f606c3619aaae74b43be170527065c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 30 Oct 2026 15:49:35 +0100 Subject: [PATCH] Keep the conflicts popup open after moving a patch into a new commit If moving a custom patch into a new commit stops at a conflict, CheckMergeOrRebase shows the "Conflicts!" popup. The handler then focused the commits view anyway, and this closed the popup. Only focus the commits view if the operation finished. Co-Authored-By: Claude Opus 5.5 --- .../custom_patch_options_menu_action.go | 14 ++++++++++---- ...ove_patch_to_new_commit_before_with_conflict.go | 11 ----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pkg/gui/controllers/custom_patch_options_menu_action.go b/pkg/gui/controllers/custom_patch_options_menu_action.go index 164c54af4..bb7bfa7ef 100644 --- a/pkg/gui/controllers/custom_patch_options_menu_action.go +++ b/pkg/gui/controllers/custom_patch_options_menu_action.go @@ -199,15 +199,21 @@ func (self *CustomPatchOptionsMenuAction) pullPatchIntoNewCommit(beforeOriginalC self.c.Helpers().Commits.CloseCommitMessagePanel() return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error { self.c.LogAction(self.c.Tr.Actions.MovePatchIntoNewCommit) - var err error + var result error if beforeOriginalCommit { - err = self.c.Git().Patch.PullPatchIntoNewCommitBefore(commits, commitIndex, summary, description) + result = self.c.Git().Patch.PullPatchIntoNewCommitBefore(commits, commitIndex, summary, description) } else { - err = self.c.Git().Patch.PullPatchIntoNewCommit(commits, commitIndex, summary, description) + result = self.c.Git().Patch.PullPatchIntoNewCommit(commits, commitIndex, summary, description) } - if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err); err != nil { + if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(result); err != nil { return err } + // If the rebase stopped at conflicts, CheckMergeOrRebase has asked the + // user how to handle them; focusing the commits view would close that + // popup. + if result != nil { + return nil + } self.c.OnUIThread(func() error { self.c.Context().Push(self.c.Contexts().LocalCommits, types.OnFocusOpts{}) return nil diff --git a/pkg/integration/tests/main_view/move_patch_to_new_commit_before_with_conflict.go b/pkg/integration/tests/main_view/move_patch_to_new_commit_before_with_conflict.go index 512cb1436..5d2c8fcfd 100644 --- a/pkg/integration/tests/main_view/move_patch_to_new_commit_before_with_conflict.go +++ b/pkg/integration/tests/main_view/move_patch_to_new_commit_before_with_conflict.go @@ -47,7 +47,6 @@ var MovePatchToNewCommitBeforeWithConflict = NewIntegrationTest(NewIntegrationTe InitialText(Equals("")). Type("new commit").Confirm() - /* EXPECTED: t.Common().AcknowledgeConflicts() t.Views().Files(). @@ -55,15 +54,5 @@ var MovePatchToNewCommitBeforeWithConflict = NewIntegrationTest(NewIntegrationTe Lines( Contains("UU").Contains("file1"), ) - ACTUAL: */ - t.Views().Commits(). - IsFocused(). - Lines( - Contains("─── Pending rebase todos"), - Contains("pick").Contains("<-- CONFLICT --- commit to move from"), - Contains("─── Commits"), - Contains("new commit"), - Contains("first commit"), - ) }, })