summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commit_message_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-10 11:40:42 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-10 11:54:38 +1000
commite42e7e5cbd9d075ee24ae8f91ba9e12bdd42fafc (patch)
tree61d65a544c056b3bf0384cf6954b81b292eb4b07 /pkg/gui/commit_message_panel.go
parent93fac1f3124f87009091230f61cc13b5e5473cb5 (diff)
fix commit amend
Diffstat (limited to 'pkg/gui/commit_message_panel.go')
-rw-r--r--pkg/gui/commit_message_panel.go34
1 files changed, 4 insertions, 30 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 0d6b5b780..133174d77 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -1,7 +1,6 @@
package gui
import (
- "os/exec"
"strconv"
"strings"
@@ -9,24 +8,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
-// runSyncOrAsyncCommand takes the output of a command that may have returned
-// either no error, an error, or a subprocess to execute, and if a subprocess
-// needs to be run, it runs it
-func (gui *Gui) runSyncOrAsyncCommand(sub *exec.Cmd, err error) (bool, error) {
- if err != nil {
- return false, gui.surfaceError(err)
- }
- if sub == nil {
- return true, nil
- }
-
- err = gui.runSubprocessWithSuspense(sub)
- if err != nil {
- return false, err
- }
- return true, nil
-}
-
func (gui *Gui) handleCommitConfirm() error {
message := gui.trimmedContent(gui.Views.CommitMessage)
if message == "" {
@@ -37,19 +18,12 @@ func (gui *Gui) handleCommitConfirm() error {
if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) {
flags = "--no-verify"
}
- ok, err := gui.runSyncOrAsyncCommand(gui.GitCommand.Commit(message, flags))
- if err != nil {
- return err
- }
-
- _ = gui.returnFromContext()
- if !ok {
+ return gui.withGpgHandling(gui.GitCommand.CommitCmdStr(message, flags), gui.Tr.CommittingStatus, func() error {
+ _ = gui.returnFromContext()
+ gui.clearEditorView(gui.Views.CommitMessage)
return nil
- }
-
- gui.clearEditorView(gui.Views.CommitMessage)
- return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
+ })
}
func (gui *Gui) handleCommitClose() error {