From f530f99f023a107885bf9d7c5e864e0c1efe8387 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 19 Jan 2017 13:01:56 +0100 Subject: [PATCH] Fix CreateLocalGitDirectory for tests. If you didn't setup user.email and user.name `git commit` fails. This configures user.email and user.name for newly created temporary git repo. --- pkg/testutils/git.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/testutils/git.go b/pkg/testutils/git.go index e446ebff..b89c0a29 100644 --- a/pkg/testutils/git.go +++ b/pkg/testutils/git.go @@ -26,9 +26,12 @@ func CreateLocalDirectory(t *testing.T) string { func CreateLocalGitDirectory(t *testing.T) string { dir := CreateLocalDirectory(t) cmd := NewCommand( - `git init && touch README && - git add README && - git commit -m 'testcommit'`) + `git init && + git config user.email "you@example.com" && + git config user.name "Your Name" && + touch README && + git add README && + git commit --no-gpg-sign -m 'testcommit'`) cmd.Dir = dir _, err := cmd.Output() if err != nil {