When I use git show-index
I get something like this:
12 3efc399e3f684061ef13c5b7dfde66342ef23033 (44b2e14e)
218 53f4215e537f351457713ad4f18d6e5d5dedf333 (480e84f1)
422 b532ec8e8e38c52002e953c878010391245eaa84 (bbaa1b63)
625 bb4359ded039eefe9fab5c99f196c67ba1a9493e (68e4b84f)
According to the man page, the first two values are the offset in the packfile and the sha1 of each object. But what's that third value in parentheses? I can't find anything about that.
Beginning with version two packfiles, this is the CRC32 of the packfile data.
It's not the CRC32 of the object - that would be redundant, with the SHA1 value right there - it's the CRC32 of the actual compressed (or deltafied) packfile data. This allows you to read the data out of the packfile and validate it without uncompressing it or applying the deltas to reconstitute the full object.
Here is a corresponding snippet from show-index.c
:
printf("%" PRIuMAX " %s (%08"PRIx32")\n",
(uintmax_t) offset,
sha1_to_hex(entries[i].sha1),
ntohl(entries[i].crc));
That makes it look like the third column is a CRC of the object whose hash is the second column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With