]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Ignore detached git branches.
authorJoshua Spence <josh@joshuaspence.com>
Sun, 9 Mar 2014 15:04:33 +0000 (08:04 -0700)
committerepriestley <git@epriestley.com>
Sun, 9 Mar 2014 15:04:33 +0000 (08:04 -0700)
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

index 8a9f680a7566f327eb234eadff41e40c884e2e2c..6a0c0262f0778b43661c8cde36d1665eab0725d0 100644 (file)
@@ -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;