diff options
author | Luka Markušić <luka.markusic@microblink.com> | 2022-07-29 07:50:01 +0200 |
---|---|---|
committer | Luka Markušić <luka.markusic@microblink.com> | 2022-07-30 08:43:42 +0200 |
commit | cc377b5c498260ed9f0444c7a7d28c35f884d1d4 (patch) | |
tree | 695dd5ee51ce210ecfc2191f3909f587865fb8cf /pkg | |
parent | 367b0d331836c90c015bf0c45f88612f3d94d08a (diff) |
Fix rewording a merge commit with editor
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 1d1420a97..6539a13af 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -227,11 +227,11 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error { } func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error { - applied, err := self.handleMidRebaseCommand("reword", commit) + midRebase, err := self.handleMidRebaseCommand("reword", commit) if err != nil { return err } - if applied { + if midRebase { return nil } @@ -240,6 +240,11 @@ func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error { Prompt: self.c.Tr.RewordInEditorPrompt, HandleConfirm: func() error { self.c.LogAction(self.c.Tr.Actions.RewordCommit) + + if self.context().GetSelectedLineIdx() == 0 { + return self.c.RunSubprocessAndRefresh(self.os.Cmd.New("git commit --allow-empty --amend --only")) + } + subProcess, err := self.git.Rebase.RewordCommitInEditor( self.model.Commits, self.context().GetSelectedLineIdx(), ) |