From bbf4ce79e34131e17691e551cbc7f3480fb7a802 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 26 Oct 2015 21:12:16 +0000 Subject: [PATCH] Provide a username and email when running `git merge --squash` Summary: Ref T182. This command should never actually generate a commit because `--squash` prevents that, but `git` seems to sometimes hit a check for username/email configuration (maybe when merging a non-fastforward?). Give it some dummy values to placate it. This command shouldn't commit anything so these values should never actually be used. Test Plan: Landed rGITTESTd8c8643cb02bbe60048c6c206afc2940c760a77e. Reviewers: chad, Mnkras Reviewed By: Mnkras Maniphest Tasks: T182 Differential Revision: https://secure.phabricator.com/D14347 --- ...dockWorkingCopyBlueprintImplementation.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php index 6694e0d72a..f39353a8f4 100644 --- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php @@ -431,17 +431,28 @@ final class DrydockWorkingCopyBlueprintImplementation $src_ref, $src_ref); - $command = csprintf( - 'git merge --no-stat --squash -- %R', + // NOTE: This can never actually generate a commit because we pass + // "--squash", but git sometimes runs code to check that a username and + // email are configured anyway. + $real_command = csprintf( + 'git -c user.name=%s -c user.email=%s merge --no-stat --squash -- %R', + 'drydock', + 'drydock@phabricator', + $src_ref); + + // Show the user a simplified command if the operation fails and we need to + // report an error. + $show_command = csprintf( + 'git merge --squash -- %R', $src_ref); try { - $interface->execx('%C', $command); + $interface->execx('%C', $real_command); } catch (CommandException $ex) { $this->setWorkingCopyVCSErrorFromCommandException( $lease, self::PHASE_SQUASHMERGE, - $command, + $show_command, $ex); throw $ex;