@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+29 -5
+14 -4
src/applications/repository/daemon/PhabricatorGitGraphStream.php
··· 5 5 6 6 private $repository; 7 7 private $iterator; 8 + private $startCommit; 8 9 9 10 private $parents = array(); 10 11 private $dates = array(); ··· 14 15 $start_commit = null) { 15 16 16 17 $this->repository = $repository; 18 + $this->startCommit = $start_commit; 17 19 18 20 if ($start_commit !== null) { 19 21 $future = $repository->getLocalCommandFuture( ··· 82 84 } 83 85 } 84 86 85 - throw new Exception( 86 - pht( 87 - "No such commit '%s' in repository!", 88 - $commit)); 87 + if ($this->startCommit !== null) { 88 + throw new Exception( 89 + pht( 90 + 'Commit "%s" is not a reachable ancestor of "%s".', 91 + $commit, 92 + $this->startCommit)); 93 + } else { 94 + throw new Exception( 95 + pht( 96 + 'Commit "%s" is not a reachable ancestor of any ref.', 97 + $commit)); 98 + } 89 99 } 90 100 91 101 private function isParsed($commit) {
+15 -1
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 157 157 $name = $ref->getShortName(); 158 158 $commit = $ref->getCommitIdentifier(); 159 159 160 - $this->log(pht('Examining ref "%s", at "%s".', $name, $commit)); 160 + $this->log( 161 + pht( 162 + 'Examining "%s" (%s) at "%s".', 163 + $name, 164 + $ref->getRefType(), 165 + $commit)); 161 166 162 167 if (!$repository->shouldTrackRef($ref)) { 163 168 $this->log(pht('Skipping, ref is untracked.')); ··· 166 171 167 172 if ($this->isKnownCommit($commit)) { 168 173 $this->log(pht('Skipping, HEAD is known.')); 174 + continue; 175 + } 176 + 177 + // In Git, it's possible to tag a tag. We just skip these, we'll discover 178 + // them when we process the target tag. See T11180. 179 + $fields = $ref->getRawFields(); 180 + $tag_type = idx($fields, '*objecttype'); 181 + if ($tag_type == 'tag') { 182 + $this->log(pht('Skipping, this is a tag of a tag.')); 169 183 continue; 170 184 } 171 185