Compare commits

...

4 Commits

Author SHA1 Message Date
Stefan Haller
1b4cceddb1 Use Rewording instead of Committing when rewording the head commit
Now that we have this status, let's use it for the head case too, for
consistency.
2025-02-28 13:18:51 +01:00
Stefan Haller
4991ff4078 Use a WithWaitingStatus for rewording a non-head commit
Rewording a commit at the beginning of a long branch can take very long;
without this change, the commit message panel would stay visible with a blinking
cursor during that time, which is very confusing.

This has the slight downside that it will say "Rebasing" in the lower right
corner until the operation is done; but we already have this problem when doing
custom patch operations, or dropping changes from a commit, so it's not new, and
we can think about how to fix all these another time.
2025-02-28 13:17:47 +01:00
Stefan Haller
50aa7e7764 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.
2025-02-28 13:13:27 +01:00
Stefan Haller
b16013fde1 Don't call OnCommitSuccess in handleReword
All this does is clear the preserved commit message; however, we open the commit
message panel with PreserveMessage: false when rewording, so this is not
necessary.
2025-02-28 13:00:09 +01:00
2 changed files with 11 additions and 11 deletions

View File

@@ -409,21 +409,19 @@ 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),
self.c.Tr.CommittingStatus, nil)
} else {
err = self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description)
return self.c.Helpers().GPG.WithGpgHandling(self.c.Git().Commit.RewordLastCommit(summary, description),
self.c.Tr.RewordingStatus, nil)
}
if err != nil {
return err
}
self.c.Helpers().Commits.OnCommitSuccess()
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
return self.c.WithWaitingStatus(self.c.Tr.RewordingStatus, func(gocui.Task) error {
err := self.c.Git().Rebase.RewordCommit(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), summary, description)
if err != nil {
return err
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
})
}
func (self *LocalCommitsController) doRewordEditor() error {

View File

@@ -384,6 +384,7 @@ type TranslationSet struct {
RedoingStatus string
CheckingOutStatus string
CommittingStatus string
RewordingStatus string
RevertingStatus string
CreatingFixupCommitStatus string
CommitFiles string
@@ -1425,6 +1426,7 @@ func EnglishTranslationSet() *TranslationSet {
RedoingStatus: "Redoing",
CheckingOutStatus: "Checking out",
CommittingStatus: "Committing",
RewordingStatus: "Rewording",
RevertingStatus: "Reverting",
CreatingFixupCommitStatus: "Creating fixup commit",
CommitFiles: "Commit files",