From 5af0ea85fcfdd02d7ac72bc11b68e432a70bafdf Mon Sep 17 00:00:00 2001 From: AzraelSec Date: Wed, 15 May 2024 23:34:44 +0200 Subject: feat: focus on local commits view after moving code into new commit --- pkg/gui/controllers/custom_patch_options_menu_action.go | 5 ++++- .../tests/patch_building/move_to_new_commit_partial_hunk.go | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/gui/controllers/custom_patch_options_menu_action.go b/pkg/gui/controllers/custom_patch_options_menu_action.go index 2d57f0ac0..f5099ae2e 100644 --- a/pkg/gui/controllers/custom_patch_options_menu_action.go +++ b/pkg/gui/controllers/custom_patch_options_menu_action.go @@ -217,7 +217,10 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error { _ = self.c.Helpers().Commits.PopCommitMessageContexts() self.c.LogAction(self.c.Tr.Actions.MovePatchIntoNewCommit) err := self.c.Git().Patch.PullPatchIntoNewCommit(self.c.Model().Commits, commitIndex, summary, description) - return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err) + if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err); err != nil { + return err + } + return self.c.PushContext(self.c.Contexts().LocalCommits) }) }, }, diff --git a/pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go b/pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go index dd0b4c3f2..62dfb1dec 100644 --- a/pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go +++ b/pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go @@ -51,6 +51,16 @@ var MoveToNewCommitPartialHunk = NewIntegrationTest(NewIntegrationTestArgs{ InitialText(Equals("")). Type("new commit").Confirm() + t.Views().Commits(). + IsFocused(). + Lines( + Contains("third commit"), + Contains("new commit").IsSelected(), + Contains("commit to move from"), + Contains("first commit"), + ). + PressEnter() + t.Views().CommitFiles(). IsFocused(). Lines( -- cgit v1.2.3