mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Handle tag tags properly in discovery
Summary: Fixes T11180. In Git, it's possible to tag a tag (????). When you do, we try to log the tag-object, which automatically resolves to the commit and fails. Just skip these. If "A" points at "B" which points at "C", it's fine to ignore "A" and "B" since we'll get the same stuff when we process "C". Test Plan: - Tagged a tag. - Pushed it. - Discovered it. - Before patch: got exception similar to the one in T11180. - After patch: got tag-tag skipped. Also got slightly better error messages. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11180 Differential Revision: https://secure.phabricator.com/D16149
This commit is contained in:
parent
f763c314e1
commit
9a2c2505a0
2 changed files with 29 additions and 5 deletions
|
@ -5,6 +5,7 @@ final class PhabricatorGitGraphStream
|
|||
|
||||
private $repository;
|
||||
private $iterator;
|
||||
private $startCommit;
|
||||
|
||||
private $parents = array();
|
||||
private $dates = array();
|
||||
|
@ -14,6 +15,7 @@ final class PhabricatorGitGraphStream
|
|||
$start_commit = null) {
|
||||
|
||||
$this->repository = $repository;
|
||||
$this->startCommit = $start_commit;
|
||||
|
||||
if ($start_commit !== null) {
|
||||
$future = $repository->getLocalCommandFuture(
|
||||
|
@ -82,11 +84,19 @@ final class PhabricatorGitGraphStream
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->startCommit !== null) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
"No such commit '%s' in repository!",
|
||||
'Commit "%s" is not a reachable ancestor of "%s".',
|
||||
$commit,
|
||||
$this->startCommit));
|
||||
} else {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Commit "%s" is not a reachable ancestor of any ref.',
|
||||
$commit));
|
||||
}
|
||||
}
|
||||
|
||||
private function isParsed($commit) {
|
||||
return isset($this->dates[$commit]);
|
||||
|
|
|
@ -157,7 +157,12 @@ final class PhabricatorRepositoryDiscoveryEngine
|
|||
$name = $ref->getShortName();
|
||||
$commit = $ref->getCommitIdentifier();
|
||||
|
||||
$this->log(pht('Examining ref "%s", at "%s".', $name, $commit));
|
||||
$this->log(
|
||||
pht(
|
||||
'Examining "%s" (%s) at "%s".',
|
||||
$name,
|
||||
$ref->getRefType(),
|
||||
$commit));
|
||||
|
||||
if (!$repository->shouldTrackRef($ref)) {
|
||||
$this->log(pht('Skipping, ref is untracked.'));
|
||||
|
@ -169,6 +174,15 @@ final class PhabricatorRepositoryDiscoveryEngine
|
|||
continue;
|
||||
}
|
||||
|
||||
// In Git, it's possible to tag a tag. We just skip these, we'll discover
|
||||
// them when we process the target tag. See T11180.
|
||||
$fields = $ref->getRawFields();
|
||||
$tag_type = idx($fields, '*objecttype');
|
||||
if ($tag_type == 'tag') {
|
||||
$this->log(pht('Skipping, this is a tag of a tag.'));
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->log(pht('Looking for new commits.'));
|
||||
|
||||
$head_refs = $this->discoverStreamAncestry(
|
||||
|
|
Loading…
Reference in a new issue