diff --git a/files_panel.go b/files_panel.go index ad4f9e809..50d6b64e2 100644 --- a/files_panel.go +++ b/files_panel.go @@ -160,8 +160,8 @@ func handleCommitPress(g *gocui.Gui, filesView *gocui.View) error { if message == "" { return createErrorPanel(g, "You cannot commit without a commit message") } - if err := gitCommit(message); err != nil { - panic(err) + if output, err := gitCommit(message); err != nil { + return createErrorPanel(g, output) } refreshFiles(g) return refreshCommits(g) diff --git a/gitcommands.go b/gitcommands.go index 719a8ceb0..d537672a0 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -445,9 +445,8 @@ func removeFile(file GitFile) error { return err } -func gitCommit(message string) error { - _, err := runDirectCommand("git commit -m \"" + message + "\"") - return err +func gitCommit(message string) (string, error) { + return runCommand("git commit -m \"" + message + "\"") } func gitPull() (string, error) {