Reputation: 3011
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.
Upvotes: 5
Views: 159
Reputation: 1329552
Git 2.19 (Q3 2018) brings more details on git show-index
format output, especially in the context of the index V2.
It points out that commit 32637cd (show-index.c
: learn about index v2,
2007-04-09, Git v1.5.2) changed the output format of show-index
to include the object CRC32 but didn't update the documentation.
See commit fb3010c (28 May 2018) by Jeff King (peff
).
(Merged by Jeff King -- peff
-- in commit fb3010c, 28 May 2018)
The git show-index
man page now includes:
The output consists of one object per line, with each line containing two or three space-separated columns:
the first column is the offset in bytes of the object within the corresponding packfile,
the second column is the object id of the object,
if the index version is 2 or higher, the third column contains the CRC32 of the object data
Upvotes: 1
Reputation: 78873
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.
Upvotes: 1
Reputation: 4462
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.
Upvotes: 1