From f70d1ccc052c0601b4b92c243b81f03d5ae31fe6 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 2 Feb 2019 11:08:50 +0100 Subject: [PATCH] Add error logging to git add and commit --- file.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index cbb4c33..2f47c30 100644 --- a/file.go +++ b/file.go @@ -52,11 +52,19 @@ func (fp *FilePages) Save(p string, page Page, summary, author string) { func saveWithGit(fp *FilePages, p string, summary, author string) { cmd := exec.Command("git", "add", ".") cmd.Dir = fp.dirname - cmd.Run() + err := cmd.Run() + if err != nil { + log.Println(err) + return + } cmd = exec.Command("git", "commit", "-m", "Changes to "+p+" by "+author+"\n\n"+summary) cmd.Dir = fp.dirname - cmd.Run() + err = cmd.Run() + if err != nil { + log.Println(err) + return + } } func (fp *FilePages) Exist(p string) bool {