From 446e5c4599ba01c28dc90bdee873bc01c9cc618e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 11 Feb 2013 15:58:47 -0800 Subject: [PATCH] Apply rtrim() to arc:upstream Summary: Git spits these out with \n at the end. Test Plan: ``` >>> orbital ~/devtools/arcanist $ git branch --set-upstream trim master Branch trim set up to track local branch master. >>> orbital ~/devtools/arcanist $ arc which --base arc:upstream RELATIVE COMMIT If you run 'arc diff', changes between the commit: acf7600e6e728395 Temporarily restore apache/license linters ...and the current working copy state will be sent to Differential, because it is the merge-base of the upstream of the current branch and HEAD, and matched the rule 'arc:upstream' in your args 'base' configuration. You can see the exact changes that will be sent by running this command: $ git diff acf7600e6e728395..HEAD These commits will be included in the diff: 3580555e4b30598f WIP MATCHING REVISIONS These Differential revisions match the changes in this working copy: (No revisions match.) Since there are no revisions in Differential which match this working copy, a new revision will be created if you run 'arc diff'. ``` Reviewers: brennantaylor Reviewed By: brennantaylor CC: aran Differential Revision: https://secure.phabricator.com/D4913 --- src/repository/api/ArcanistGitAPI.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 2420af5a..b6704a74 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -975,9 +975,11 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { list($err, $upstream) = $this->execManualLocal( "rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'"); if (!$err) { + $upstream = rtrim($upstream); list($upstream_merge_base) = $this->execxLocal( 'merge-base %s HEAD', $upstream); + $upstream_merge_base = rtrim($upstream_merge_base); $this->setBaseCommitExplanation( "it is the merge-base of the upstream of the current branch ". "and HEAD, and matched the rule '{$rule}' in your {$source} ".