diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-04-06 15:33:00 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-09-18 10:50:19 +0200 |
commit | a642395e9f7794e77eac350b063cb975a49ba6f4 (patch) | |
tree | 20d7c27a1142359aadfb695853c604080e0c1d1f /pkg/gui/controllers/helpers/cherry_pick_helper.go | |
parent | 70bfeddc907037d1aa6ae9fc869441f3429c388a (diff) |
Allow cherry-picking commits during a rebase
This can be useful when you know that a cherry-picked commit would conflict at
the tip of your branch, but doesn't at the beginning of the branch (or
somewhere in the middle). In that case you want to be able to edit the commit
before where you want to insert the cherry-picked commits, and then paste to
insert them into the todo list at that point.
Diffstat (limited to 'pkg/gui/controllers/helpers/cherry_pick_helper.go')
-rw-r--r-- | pkg/gui/controllers/helpers/cherry_pick_helper.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go index e27e469b6..4f455ca30 100644 --- a/pkg/gui/controllers/helpers/cherry_pick_helper.go +++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go @@ -76,6 +76,19 @@ func (self *CherryPickHelper) Paste() error { Title: self.c.Tr.CherryPick, Prompt: self.c.Tr.SureCherryPick, HandleConfirm: func() error { + isInRebase, err := self.c.Git().Status.IsInInteractiveRebase() + if err != nil { + return err + } + if isInRebase { + if err := self.c.Git().Rebase.CherryPickCommitsDuringRebase(self.getData().CherryPickedCommits); err != nil { + return err + } + return self.c.Refresh(types.RefreshOptions{ + Mode: types.SYNC, Scope: []types.RefreshableView{types.REBASE_COMMITS}, + }) + } + return self.c.WithWaitingStatus(self.c.Tr.CherryPickingStatus, func(gocui.Task) error { self.c.LogAction(self.c.Tr.Actions.CherryPick) err := self.c.Git().Rebase.CherryPickCommits(self.getData().CherryPickedCommits) |