diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -40,6 +40,9 @@ // If this VCS supports branches, check that the selected branch actually // exists. if ($drequest->supportsBranches()) { + $branch = $drequest->getBranch(); + $tracking = $repository->shouldTrackBranch($branch); + // NOTE: Mercurial may have multiple branch heads with the same name. $ref_cursors = id(new PhabricatorRepositoryRefCursorQuery()) ->setViewer($viewer) @@ -47,7 +50,7 @@ ->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH)) ->withRefNames(array($drequest->getBranch())) ->execute(); - if ($ref_cursors) { + if ($ref_cursors && $tracking) { // This is a valid branch, so we necessarily have some content. $page_has_content = true; } else { @@ -57,6 +60,17 @@ $empty_message = pht( 'There is no branch named "%s" in this repository.', $drequest->getBranch()); + } else if (!$tracking) { + $empty_title = pht('Branch Not Tracked'); + if ($default != $drequest->getBranch()) { + $empty_message = pht( + 'The branch named "%s" is not being tracked.', + $drequest->getBranch()); + } else { + $empty_message = pht( + 'The branch named "%s" is configured as the default, but is not '. + 'being tracked.', $drequest->getBranch()); + } } else { $empty_title = pht('No Default Branch'); $empty_message = pht(