From eda65cbadee9d84ac2566953854b255ec91b697c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 28 Feb 2025 13:03:47 +0100 Subject: [PATCH] Avoid double Refresh when rewording the head commit WithGpgHandling already does an async refresh when done, so there's no need to do one here for the case of amending the head commit. On top of that, WithGpgHandling uses WithWaitingStatus and works in the background, so the Refresh here would come too early anyway. --- pkg/gui/controllers/local_commits_controller.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index a947d8d76..a57ec26c5 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -409,16 +409,13 @@ func (self *LocalCommitsController) switchFromCommitMessagePanelToEditor(filepat } func (self *LocalCommitsController) handleReword(summary string, description string) error { - 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), + return 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) } + err := self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description) if err != nil { return err }