Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pack file entry format

My understanding of the Git pack file format is something like: alt text

Where the table is 32-bits wide, and the first three 32-bit words are the pack file header. The last row of 32 bits are the first 4 bytes of an entry. As I understand it, the size of the entry is specified by consecutive bytes with the MSB set, followed by compressed data.

In the first byte whose MSB is not set, is the MSB part of the compressed data, or is it a gap? If it's part of the compressed data, how can you guarantee that when the data is compressed that bit won't be set?

like image 855
Ben Collins Avatar asked Sep 16 '08 19:09

Ben Collins


2 Answers

There is also some graphical documentation explaining some of the format here. This section is no longer present in Community book, but still available it the location above.

like image 33
Scott Chacon Avatar answered Sep 21 '22 02:09

Scott Chacon


My reading of the pack file documentation indicates that the last byte of the size (offset 15 in your example) would have the MSB set to 0.

like image 58
Greg Hewgill Avatar answered Sep 23 '22 02:09

Greg Hewgill