Skip to content

Dumb HTTP clone skips loose objects when the server lists packs #18

Closed

Description

@dnnsjsk

When clone() falls back to dumb HTTP and the server lists packs in objects/info/packs, Pitmaster downloads those packs and returns without fetching any loose objects (

pitmaster/src/Pitmaster.php

Lines 486 to 504 in 5beb97d

private static function importDumbHttpObjects(
Repository $repo,
DumbHttpClient $client,
string $url,
array $refs,
): void {
$packs = $client->fetchPackList($url);
if ($packs !== []) {
foreach ($packs as $packName) {
self::writePackFile($repo->gitDir(), $client->fetchPack($url, $packName), $packName);
$idxName = preg_replace('/\.pack$/', '.idx', $packName) ?? $packName . '.idx';
self::writePackFile($repo->gitDir(), $client->fetchPack($url, $idxName), $idxName);
}
$repo->objectDatabase()->refresh();
return;
}
). Objects that exist only as loose files on the server (commits made after the last repack) are never downloaded.

Repro

A bare repository served over plain HTTP that has a pack plus newer loose commits, with git update-server-info run: Pitmaster::clone() against it (after smart HTTP fails) returns a repository whose HEAD points to a missing object; head() throws "HEAD points to a non-commit object".

Expected

After importing the listed packs, walk from the ref tips and fetch any object that is still missing as a loose object, as git's dumb HTTP walker does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions