1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Allow rewording for last commit using GPG

This commit is contained in:
Neko Box Coder
2024-08-10 13:25:35 +01:00
committed by Stefan Haller
parent ce6388bdfa
commit 4a2508e960
4 changed files with 14 additions and 10 deletions

View File

@ -400,7 +400,16 @@ func (self *LocalCommitsController) switchFromCommitMessagePanelToEditor(filepat
}
func (self *LocalCommitsController) handleReword(summary string, description string) error {
err := self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description)
var err error
if models.IsHeadCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx()) {
// we've selected the top commit so no rebase is required
err = self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
self.c.Tr.CommittingStatus, nil)
} else {
err = self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description)
}
if err != nil {
return err
}