1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

no panic on git commit error

This commit is contained in:
Jesse Duffield 2018-08-06 18:55:08 +10:00
parent 0e0acc90e1
commit b1918f2f68
2 changed files with 4 additions and 5 deletions

View File

@ -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)

View File

@ -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) {