1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

Only load refs that are actual commits

Summary: Fix T11301. Git is git.

Test Plan: tagged a file! run discover. no crash.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T11301

Differential Revision: https://secure.phabricator.com/D16261
This commit is contained in:
Aviv Eyal 2016-07-08 22:34:25 +00:00 committed by avivey
parent 1a303e7d2a
commit c56a4fce66
3 changed files with 6 additions and 4 deletions

View file

@ -174,12 +174,13 @@ final class PhabricatorRepositoryDiscoveryEngine
continue; continue;
} }
// In Git, it's possible to tag a tag. We just skip these, we'll discover // In Git, it's possible to tag anything. We just skip tags that don't
// them when we process the target tag. See T11180. // point to a commit. See T11301.
$fields = $ref->getRawFields(); $fields = $ref->getRawFields();
$ref_type = idx($fields, 'objecttype');
$tag_type = idx($fields, '*objecttype'); $tag_type = idx($fields, '*objecttype');
if ($tag_type == 'tag') { if ($ref_type != 'commit' && $tag_type != 'commit') {
$this->log(pht('Skipping, this is a tag of a tag.')); $this->log(pht('Skipping, this is not a commit.'));
continue; continue;
} }

View file

@ -30,6 +30,7 @@ final class PhabricatorWorkingCopyDiscoveryTestCase
$this->assertEqual( $this->assertEqual(
array( array(
'763d4ab372445551c95fb5cccd1a7a223f5b2ac8', '763d4ab372445551c95fb5cccd1a7a223f5b2ac8',
'41fa35914aa19c1aa6e57004d9745c05929c3563',
), ),
mpull($refs, 'getIdentifier')); mpull($refs, 'getIdentifier'));
} }