]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't use "-c" flag in "git:branch-unique()" revision range rule
authorepriestley <git@epriestley.com>
Thu, 10 Dec 2015 22:10:02 +0000 (14:10 -0800)
committerepriestley <git@epriestley.com>
Thu, 10 Dec 2015 22:19:39 +0000 (14:19 -0800)
Summary:
Fixes T9953.

  - "-c" was introduced in 1.7.2.
  - "--no-color" has existed forever as far as I can tell.
  - "--no-column" was introducd in 1.7.11, but there was nothing that needed to be disabled before that (hopefully).

Test Plan:
  - Ran `arc which --trace` and observed a reasonable `git branch` command with correct output.
  - Ran `arc which --trace` with a faked older Git version, observed command omit `--no-column`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9953

Differential Revision: https://secure.phabricator.com/D14735

src/repository/api/ArcanistGitAPI.php

index 8d8181e3e230a7d82e397fa5fc1112e1598e238d..8600674c13b8a78f4832f6cd3d6f31646fcd804a 100644 (file)
@@ -1216,8 +1216,20 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
             // Ideally, we would use something like "for-each-ref --contains"
             // to get a filtered list of branches ready for script consumption.
             // Instead, try to get predictable output from "branch --contains".
+
+            $flags = array();
+            $flags[] = '--no-color';
+
+            // NOTE: The "--no-column" flag was introduced in Git 1.7.11, so
+            // don't pass it if we're running an older version. See T9953.
+            $version = $this->getGitVersion();
+            if (version_compare($version, '1.7.11', '>=')) {
+              $flags[] = '--no-column';
+            }
+
             list($branches) = $this->execxLocal(
-              '-c column.ui=never -c color.ui=never branch --contains %s',
+              'branch %Ls --contains %s',
+              $flags,
               $commit);
             $branches = array_filter(explode("\n", $branches));