]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Apply rtrim() to arc:upstream
authorepriestley <git@epriestley.com>
Mon, 11 Feb 2013 23:58:47 +0000 (15:58 -0800)
committerepriestley <git@epriestley.com>
Mon, 11 Feb 2013 23:58:47 +0000 (15:58 -0800)
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

index 2420af5a03e5a696d7b2125c490c20e229b4f901..b6704a74cbb6e398b93a3eb883550e5f1baf9393 100644 (file)
@@ -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} ".