I’m working on a simple PHP read-only implementation of Git and I’ve got it mostly working, but I can’t figure out what the exact format is of Git pack index files (version 2). All documentation I have found so far is either vague and only focused towards interpreting them with Git itself, or only applies to version 1 which is, from my understanding, considerably different. Using an existing Git implementation for PHP is not an option (I’ve tried a few, and keep hitting issues with them).
I’m basically in need of some simple and generic documentation about the format of a v2 pack index file, nothing PHP-specific. Where can I find this?
The documentation included with the Git sources seems to have a reasonably complete description of the v1 and v2 packfile formats.
And of course there are a variety of other software implements that understand this format, including dulwich for Python and of course libgit2 for C. Studying these may help out your understanding if the technical documentation is unclear.