mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Fix parsing of Git branches with common and useful name "0"
Summary: See <https://discourse.phabricator-community.org/t/arc-has-a-spurious-failure-on-arc-diff/521>. Oh, PHP! Test Plan: Created a branch named "0", ran `arc diff`. Before: fatal. After: this beautiful revision. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D18678
This commit is contained in:
parent
c804c50260
commit
76b54ce0a9
2 changed files with 7 additions and 3 deletions
|
@ -497,6 +497,10 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strlen($branch)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $branch;
|
return $branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +513,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
// Verify this, and strip it.
|
// Verify this, and strip it.
|
||||||
$ref = rtrim($stdout);
|
$ref = rtrim($stdout);
|
||||||
$branch = $this->getBranchNameFromRef($ref);
|
$branch = $this->getBranchNameFromRef($ref);
|
||||||
if (!$branch) {
|
if ($branch === null) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
pht('Failed to parse %s output!', 'git symbolic-ref'));
|
pht('Failed to parse %s output!', 'git symbolic-ref'));
|
||||||
}
|
}
|
||||||
|
@ -1015,7 +1019,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
list($ref, $hash, $epoch, $tree, $desc, $text) = $fields;
|
list($ref, $hash, $epoch, $tree, $desc, $text) = $fields;
|
||||||
|
|
||||||
$branch = $this->getBranchNameFromRef($ref);
|
$branch = $this->getBranchNameFromRef($ref);
|
||||||
if ($branch) {
|
if ($branch !== null) {
|
||||||
$result[] = array(
|
$result[] = array(
|
||||||
'current' => ($branch === $current),
|
'current' => ($branch === $current),
|
||||||
'name' => $branch,
|
'name' => $branch,
|
||||||
|
|
|
@ -444,7 +444,7 @@ EOTEXT
|
||||||
$branch = $this->getArgument('branch');
|
$branch = $this->getArgument('branch');
|
||||||
if (empty($branch)) {
|
if (empty($branch)) {
|
||||||
$branch = $this->getBranchOrBookmark();
|
$branch = $this->getBranchOrBookmark();
|
||||||
if ($branch) {
|
if ($branch !== null) {
|
||||||
$this->branchType = $this->getBranchType($branch);
|
$this->branchType = $this->getBranchType($branch);
|
||||||
|
|
||||||
// TODO: This message is misleading when landing a detached head or
|
// TODO: This message is misleading when landing a detached head or
|
||||||
|
|
Loading…
Reference in a new issue