Repository navigation
Description
The fetch negotiation advertises thin-pack (
pitmaster/src/Protocol/ProtocolV1.php
Line 22 in 5beb97d
| 'thin-pack', |
pitmaster/src/Protocol/ProtocolV2.php
Line 28 in 5beb97d
| 'thin-pack', |
PackIndexer only looks for REF_DELTA bases inside the received pack and throws otherwise (pitmaster/src/Pack/PackIndexer.php
Lines 243 to 267 in 5beb97d
| private static function resolveRefDeltaBase( | |
| int $currentOffset, | |
| string $baseHash, | |
| array $parsed, | |
| array &$resolved, | |
| array &$hashToOffset, | |
| int $depth, | |
| ): array { | |
| if (isset($hashToOffset[$baseHash])) { | |
| return self::resolveObjectAtOffset($hashToOffset[$baseHash], $parsed, $resolved, $hashToOffset, $depth); | |
| } | |
| foreach (array_keys($parsed) as $offset) { | |
| if ($offset === $currentOffset) { | |
| continue; | |
| } | |
| $candidate = self::resolveObjectAtOffset($offset, $parsed, $resolved, $hashToOffset, $depth); | |
| if ($candidate['id']->hex === $baseHash) { | |
| return $candidate; | |
| } | |
| } | |
| throw PackParseException::invalidDeltaBase("ref-delta base {$baseHash} not found in pack"); |
A thin pack produced by git pack-objects --thin fails to index with:
PackParseException: ref-delta base 7599e0c... not found in pack
The exception is not a ProtocolException, so fetch() does not fall back and stops after writing the .pack without its .idx (
Lines 1611 to 1614 in 5beb97d
| if (!is_dir($packDir)) { | |
| mkdir($packDir, 0777, true); | |
| } | |
PackFile resolves REF_DELTA bases only within the same pack (pitmaster/src/Pack/PackFile.php
Lines 156 to 169 in 5beb97d
| } else { | |
| if ($entry->baseHash === null) { | |
| throw PackParseException::invalidDeltaBase("ref-delta missing baseHash at {$offset}"); | |
| } | |
| $basePackOffset = $this->index->findOffset($entry->baseHash); | |
| if ($basePackOffset === null) { | |
| throw PackParseException::invalidDeltaBase( | |
| "ref-delta base {$entry->baseHash} not found in pack" | |
| ); | |
| } | |
| $base = $this->resolveAtOffset($basePackOffset, $depth + 1); |
Expected
Either stop advertising thin-pack, or resolve external bases from the object database while indexing and complete the pack (append the missing bases), as git index-pack --fix-thin does.
Activity