diff --git a/src/branch/BranchInfo.php b/src/branch/BranchInfo.php index 54beae10..38881c3c 100644 --- a/src/branch/BranchInfo.php +++ b/src/branch/BranchInfo.php @@ -92,7 +92,7 @@ class BranchInfo { return $this->status; } - public function getRevisionId() { + public function getRevisionID() { return $this->revisionID; } @@ -104,6 +104,14 @@ class BranchInfo { return $this->commitSubject; } + public function getCommitDisplayName() { + if ($this->revisionID) { + return 'D'.$this->revisionID.': '.$this->commitSubject; + } else { + return $this->commitSubject; + } + } + public function getCommitAuthor() { return $this->commitAuthor; } diff --git a/src/repository/api/git/ArcanistGitAPI.php b/src/repository/api/git/ArcanistGitAPI.php index 3c466b0d..e69f7785 100644 --- a/src/repository/api/git/ArcanistGitAPI.php +++ b/src/repository/api/git/ArcanistGitAPI.php @@ -410,11 +410,17 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI { $result = array(); foreach ($lines as $line) { $match = array(); - $branch = array(); - preg_match('/^(\*?)\s*(\S+)/', $line, $match); - $branch['current'] = !empty($match[1]); - $branch['name'] = $match[2]; - $result[] = $branch; + preg_match('/^(\*?)\s*(.*)$/', $line, $match); + $name = $match[2]; + if ($name == '(no branch)') { + // Just ignore this, we could theoretically try to figure out the ref + // and treat it like a real branch but that's sort of ridiculous. + continue; + } + $result[] = array( + 'current' => !empty($match[1]), + 'name' => $name, + ); } $all_names = ipull($result, 'name'); // Calling 'git branch' first and then 'git rev-parse' is way faster than diff --git a/src/workflow/branch/ArcanistBranchWorkflow.php b/src/workflow/branch/ArcanistBranchWorkflow.php index 8019a230..fa6767f8 100644 --- a/src/workflow/branch/ArcanistBranchWorkflow.php +++ b/src/workflow/branch/ArcanistBranchWorkflow.php @@ -82,7 +82,7 @@ EOTEXT continue; } - $rev_id = $branch->getRevisionId(); + $rev_id = $branch->getRevisionID(); if ($rev_id) { $status = idx($revision_status, $rev_id, 'Unknown Status'); $branch->setStatus($status); @@ -153,7 +153,7 @@ EOTEXT echo reset($branches)->getFormattedStatus()."\n"; foreach ($branches as $branch) { $name_markdown = $branch->getFormattedName(); - $subject = $branch->getCommitSubject(); + $subject = $branch->getCommitDisplayName(); $name_markdown = str_pad($name_markdown, $longest_name + 4, ' '); echo " $name_markdown $subject\n"; } @@ -162,7 +162,7 @@ EOTEXT foreach ($this->branches as $branch) { $name_markdown = $branch->getFormattedName(); $status_markdown = $branch->getFormattedStatus(); - $subject = $branch->getCommitSubject(); + $subject = $branch->getCommitDisplayName(); $subject_pad = $longest_status - strlen($branch->getStatus()) + 4; $name_markdown = str_pad($name_markdown, $longest_name + 4, ' ');