Skip to content

Commit

Permalink
FIX GitUploadPackClient wrongly getting pack from response
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rohde committed May 23, 2024
1 parent 6182aae commit 195fa4d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Service/GitUploadPackClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,18 @@ public function fetchObjects(array $haves, array $wants, string $remote = 'origi
FileSystemUtil::mkdirIfNotExists($dir);

$tempPackPath = $dir.DIRECTORY_SEPARATOR.'pack-hash.pack';
$pack = explode("\n", $response->getBody()->getContents());

do {
$line = array_shift($pack);
} while (str_starts_with($line, '00'));

array_unshift($pack, $line);
$pack = implode("\n", $pack);

file_put_contents(
$tempPackPath,
explode("\n", $response->getBody()->getContents(), 2)[1]
$pack
);
$hash = (new Pack($tempPackPath))
->getChecksum();
Expand Down

0 comments on commit 195fa4d

Please sign in to comment.