Repository navigation
Description
Repository::fetch() writes every advertised refs/tags/* ref (
Lines 1883 to 1887 in 5beb97d
| foreach ($remoteRefs as $refName => $refId) { | |
| if (str_starts_with($refName, 'refs/tags/') && !str_ends_with($refName, '^{}')) { | |
| $this->refs->update($refName, $refId); | |
| } | |
| } |
remote.<name>.fetch (by default refs/heads/*, Lines 1789 to 1830 in 5beb97d
| private function plannedFetchRefs(string $remote, array $remoteRefs): array | |
| { | |
| $refspecs = $this->config->getAll("remote.{$remote}.fetch"); | |
| if ($refspecs === []) { | |
| $refspecs = ["+refs/heads/*:refs/remotes/{$remote}/*"]; | |
| } | |
| $negativePatterns = []; | |
| foreach ($refspecs as $refspec) { | |
| if (str_starts_with($refspec, '^')) { | |
| $negativePatterns[] = substr($refspec, 1); | |
| } | |
| } | |
| $planned = []; | |
| foreach ($refspecs as $refspec) { | |
| if (str_starts_with($refspec, '^')) { | |
| continue; | |
| } | |
| if (str_starts_with($refspec, '+')) { | |
| $refspec = substr($refspec, 1); | |
| } | |
| [$srcPattern, $dstPattern] = array_pad(explode(':', $refspec, 2), 2, null); | |
| if ($srcPattern === null || $dstPattern === null) { | |
| continue; | |
| } | |
| foreach ($remoteRefs as $src => $id) { | |
| if ($this->matchesRefspecPattern($negativePatterns, $src)) { | |
| continue; | |
| } | |
| $dst = $this->mapFetchRefspec($srcPattern, $dstPattern, $src); | |
| if ($dst === null) { | |
| continue; | |
| } |
include-tag capability (pitmaster/src/Protocol/ProtocolV1.php
Lines 18 to 28 in 5beb97d
| public const DEFAULT_FETCH_CAPABILITIES = [ | |
| 'multi_ack_detailed', | |
| 'no-done', | |
| 'side-band-64k', | |
| 'thin-pack', | |
| 'no-progress', | |
| 'ofs-delta', | |
| 'deepen-since', | |
| 'deepen-not', | |
| 'agent=Pitmaster/1.0', | |
| ]; |
An annotated tag created on the remote since the last fetch therefore becomes a local refs/tags/<name> that points to a tag object which was never downloaded. resolve('<tag>') returns that ID, and show('<tag>') / readObject() fail with a missing object, while git fsck reports a broken ref. The same applies to tags that point at commits outside the fetched branches.
Found by reading the code; the full network path was not run.
Expected
Either request include-tag (and want tag objects that are missing), or only write tag refs whose objects exist locally, as git's tag following does.
Activity