1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php
epriestley 2a37459a5f Only resolve branch names to branches
Summary: Fixes T7100. In the bizarre case that a Git repository has a branch and tag with the same name, don't resolve branch names into tag names.

Test Plan: Test repo with branch and tag both named "git" no longer reports ambiguity.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7100

Differential Revision: https://secure.phabricator.com/D12553
2015-04-27 03:51:53 -07:00

40 lines
954 B
PHP

<?php
final class DiffusionResolveRefsConduitAPIMethod
extends DiffusionQueryConduitAPIMethod {
public function getAPIMethodName() {
return 'diffusion.resolverefs';
}
public function getMethodDescription() {
return pht('Resolve references into stable, canonical identifiers.');
}
protected function defineReturnType() {
return 'dict<string, list<dict<string, wild>>>';
}
protected function defineCustomParamTypes() {
return array(
'refs' => 'required list<string>',
'types' => 'optional list<string>',
);
}
protected function getResult(ConduitAPIRequest $request) {
$refs = $request->getValue('refs');
$types = $request->getValue('types');
$query = id(new DiffusionLowLevelResolveRefsQuery())
->setRepository($this->getDiffusionRequest()->getRepository())
->withRefs($refs);
if ($types) {
$query->withTypes($types);
}
return $query->execute();
}
}