From d0e73bb656105e82582cf72c415a8c310b30915d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 10 Dec 2015 14:10:02 -0800 Subject: [PATCH] Don't use "-c" flag in "git:branch-unique()" revision range rule 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 8d8181e3..8600674c 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -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));