mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-16 00:38:38 +01:00
Summary: Fixes T7982. - When resolving branches, make sure they get type `'branch'`. - Correctly resolve refs when a repository has a branch and tag with the same name. Test Plan: Disabled ref cache and resolved refs in a Git repository with a 'master' tag and a 'master' branch. Saw refs resolve accurately. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7982 Differential Revision: https://secure.phabricator.com/D12609
23 lines
474 B
PHP
23 lines
474 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!');
|
|
}
|
|
|
|
}
|