From 92e75d4602b733e05b1dfdc774f1fc3e15f92cc8 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 08:24:24 +1000 Subject: [PATCH] "step one towards dealing with gpgsign" --- files_panel.go | 2 +- gitcommands.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/files_panel.go b/files_panel.go index 401294933..a102399f7 100644 --- a/files_panel.go +++ b/files_panel.go @@ -176,7 +176,7 @@ func handleCommitPress(g *gocui.Gui, filesView *gocui.View) error { if message == "" { return createErrorPanel(g, "You cannot commit without a commit message") } - if output, err := gitCommit(message); err != nil { + if output, err := gitCommit(g, message); err != nil { return createErrorPanel(g, output) } refreshFiles(g) diff --git a/gitcommands.go b/gitcommands.go index c8f81dd6b..0f5692e87 100644 --- a/gitcommands.go +++ b/gitcommands.go @@ -447,7 +447,12 @@ func removeFile(file GitFile) error { return err } -func gitCommit(message string) (string, error) { +func gitCommit(g *gocui.Gui, message string) (string, error) { + out, _ := runDirectCommand("git config --get commit.gpgsign") + if out != "" { + runSubProcess(g, "git", "commit", "-m", "\""+message+"\"") + return "", nil + } return runDirectCommand("git commit -m \"" + message + "\"") }