diff options
author | AzraelSec <me@azraelsec.sh> | 2024-05-15 23:34:44 +0200 |
---|---|---|
committer | AzraelSec <me@azraelsec.sh> | 2024-05-20 19:12:38 +0200 |
commit | 5af0ea85fcfdd02d7ac72bc11b68e432a70bafdf (patch) | |
tree | f458395409aefe963766a9b868bb709b7e0bf411 /pkg | |
parent | a4e9181a6b2feb8c9f7f02ea409e22857bed9464 (diff) |
feat: focus on local commits view after moving code into new commit
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/controllers/custom_patch_options_menu_action.go | 5 | ||||
-rw-r--r-- | pkg/integration/tests/patch_building/move_to_new_commit_partial_hunk.go | 10 |
2 files changed, 14 insertions, 1 deletions
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( |