From a2706f65394497404d09dab6f668c7d3699a2df6 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Sun, 9 Mar 2014 08:04:33 -0700 Subject: [PATCH] Ignore detached git branches. Summary: Fixes T4559. It looks like the code currently (at least partially) handles this by checking for `(no branch)`. I suspect that the behaviour of `git` has changed (I am running version 1.9.0) because I haven't figured out what state to be in to cause `git` to output `(no branch)`. Test Plan: Ran `arc branch` when on a detached branch. Reviewers: #blessed_reviewers, epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T4559 Differential Revision: https://secure.phabricator.com/D8466 --- src/repository/api/ArcanistGitAPI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 8a9f680a..6a0c0262 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -764,7 +764,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { $result = array(); foreach ($lines as $line) { - if (preg_match('/^[* ]+\(no branch\)/', $line)) { + if (preg_match('@^[* ]+\(no branch|detached from \w+/\w+\)@', $line)) { // This is indicating that the working copy is in a detached state; // just ignore it. continue;