mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 11:12:42 +01:00
ae263ddde5
Summary: Ref T1493. - When viewing an invalid branch, show a "there is no such branch" message. - When viewing an empty repository, show a "this repository is empty" message. Test Plan: - Viewed empty, bad branch, and nonempty in Git. - Viewed empty, bad branch, and nonempty in Mercurial. - Viewed empty and nonempty in Subversion. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T1493 Differential Revision: https://secure.phabricator.com/D9912
32 lines
716 B
PHP
32 lines
716 B
PHP
<?php
|
|
|
|
final class DiffusionGitRequest extends DiffusionRequest {
|
|
|
|
public function supportsBranches() {
|
|
return true;
|
|
}
|
|
|
|
protected function isStableCommit($symbol) {
|
|
return preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
|
}
|
|
|
|
public function getBranch() {
|
|
if ($this->branch) {
|
|
return $this->branch;
|
|
}
|
|
if ($this->repository) {
|
|
return $this->repository->getDefaultBranch();
|
|
}
|
|
throw new Exception('Unable to determine branch!');
|
|
}
|
|
|
|
protected function getResolvableBranchName($branch) {
|
|
if ($this->repository->isWorkingCopyBare()) {
|
|
return $branch;
|
|
} else {
|
|
$remote = DiffusionGitBranch::DEFAULT_GIT_REMOTE;
|
|
return $remote.'/'.$branch;
|
|
}
|
|
}
|
|
|
|
}
|