From 6966be3e7e518b35f75e18f366aecdbe2611e684 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 4 Oct 2015 08:41:48 -0700 Subject: [PATCH 1/2] Allow an arc test to execute without a git author configured Summary: On `sbuild`, we currently get a failure on this test. Use an explicit `--author` so we can run the test even if `user.email` and `user.name` are not set in global Git config. ``` FAIL ArcanistBundleTestCase::testGitRepository 15 EXCEPTION (CommandException): Command failed with error #128! 16 COMMAND 17 git commit -m 'Mark koan2 +x and edit it.' 18 19 STDOUT 20 (empty) 21 22 STDERR 23 24 *** Please tell me who you are. 25 26 Run 27 28 git config --global user.email "you@example.com" 29 git config --global user.name "Your Name" 30 31 to set your account's default identity. 32 Omit --global to set the identity only in this repository. 33 34 fatal: empty ident name (for ) not allowed ``` Test Plan: Ran `arc unit --everything`. Will verify in production. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D14232 --- src/parser/__tests__/ArcanistBundleTestCase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php index ea29726f..8ff7339e 100644 --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -137,7 +137,9 @@ final class ArcanistBundleTestCase extends PhutilTestCase { throw $ex; } - execx('git commit -m %s', $subject); + $author = 'unit-test '; + + execx('git commit --author %s -m %s', $author, $subject); list($result_hash) = execx('git log -n1 --format=%s', '%T'); $result_hash = trim($result_hash); From 172c930630a960ea79ada1dbeb50f2ad561d3870 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 4 Oct 2015 08:49:20 -0700 Subject: [PATCH 2/2] Pass author config to `git` with "-c x=y" instead of "--author" Summary: See D14232. That didn't actually work. It looks like this does. Test Plan: - Ran `git commit --author ...` on build server and saw the same failure. - Ran `git -c ... -c ... commit ...` on build server and saw it work. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D14233 --- src/parser/__tests__/ArcanistBundleTestCase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php index 8ff7339e..8fa78f0a 100644 --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -137,9 +137,15 @@ final class ArcanistBundleTestCase extends PhutilTestCase { throw $ex; } - $author = 'unit-test '; + // If these aren't configured, Git complains even if we pass --author. + $git_name = 'unit-test'; + $git_email = 'unit-test@phabricator.com'; - execx('git commit --author %s -m %s', $author, $subject); + execx( + 'git -c user.name=%s -c user.email=%s commit -m %s', + $git_name, + $git_email, + $subject); list($result_hash) = execx('git log -n1 --format=%s', '%T'); $result_hash = trim($result_hash);