Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Updates pack reading

Author Dave Jarvis <email>
Date 2026-02-08 14:41:19 GMT-0800
Commit 3eaf036b6fcfd5f01fc0ea48d24ac82d9ae70ff9
Parent 37241a9
kimi-viewer.php
$baseOffset = (($baseOffset + 1) << 7) | ($byte & 0x7f);
}
- $deltaData = gzuncompress(stream_get_contents($pack)); // Simplified for example
+
+ $compressed = stream_get_contents($pack);
+ $deltaData = @uncompressGitData($compressed);
$baseObj = readPackObject($packFile, $offset - $baseOffset);
fclose($pack);
+
return [
'type' => $baseObj['type'],
'content' => applyGitDelta($baseObj['content'], $deltaData)
];
}
// Standard Objects (Commit, Tree, Blob)
$compressed = stream_get_contents($pack);
fclose($pack);
- $uncompressed = @zlib_decode($compressed);
+
+ // Use a wrapper to handle the raw stream decompression
+ $uncompressed = @uncompressGitData($compressed);
+
+ if ($uncompressed === false) return false;
$types = ['', 'commit', 'tree', 'blob', 'tag'];
return [
'type' => $types[$type] ?? 'unknown',
'content' => $uncompressed
];
+}
+
+/**
+ * Helper to handle decompression when trailing data exists in the buffer
+ */
+function uncompressGitData($data) {
+ return @zlib_decode($data);
}
Delta 16 lines added, 2 lines removed, 14-line increase