pack file object size question
- From
- Farhan Khan <khanzf@gmail.com>
- Date
- Dec 16, 2018, 21:52 UTC
- Message-ID
- <CAFd4kYCHefqRsiFK=K7MHp=MTwOBXB5979WobEm3w1J5q1bZ0w@mail.gmail.com>
Hi all,
I am trying to write an implementation of "git index-pack" and having a bit of trouble with understanding the ".pack" format. Specifically, I am having trouble figuring out the boundary between two objects in the pack file.
It seems that there is a 12 byte header (signature, version, number of objects), then it immediately jumps into each individual object. The object consists of the object header, then the zlib deflated object, followed by a SHA1 of the above. Is this accurate? If so, where is the size of the entire object size (object header + zlib deflated object + sha) identified in git source? I tracked it down to what I believe is builtin/index-pack.c under the function parse_pack_objects, the for-loop currently in line 1138, but I cannot find where that object size is calculated for the next iteration of the loop.
I think what I most specifically need is where the size of the deflated object is identified.
Thanks, -- Farhan Khan PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE