{"thread":{"id":"63968","subject":"How To See Index File Checksum?","startedAt":"2025-08-17T01:32:31Z","lastAt":"2025-08-17T01:50:20Z","messageCount":2,"participants":["Jon Forrest","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"524313","messageId":"76ee89b3-39cf-4218-bbb6-1cc3c6e16ddf@gmail.com","threadId":"63968","inReplyTo":null,"subject":"How To See Index File Checksum?","fromName":"Jon Forrest","fromEmail":"nobozo@gmail.com","sentAt":"2025-08-17T01:32:30Z","receivedAt":"2025-08-17T01:32:31Z","isPatch":false,"sender":{"key":"nobozo@gmail.com","avatar":"https://gravatar.com/avatar/37c6a7b57f29b3f35c6a9016537907c52f15bbf98575617dc046bcec6bf06372?d=mp&s=160"},"body":"I know how to see the checksums of the files in an index\nfile. But, I can't find a git command that shows the\nchecksum at the end of an index file.\n\nAny ideas?\n\nCordially,\nJon Forrest\n\n"},{"id":"524314","messageId":"20250817015013.GA6012@coredump.intra.peff.net","threadId":"63968","inReplyTo":"76ee89b3-39cf-4218-bbb6-1cc3c6e16ddf@gmail.com","subject":"Re: How To See Index File Checksum?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-08-17T01:50:13Z","receivedAt":"2025-08-17T01:50:20Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Aug 16, 2025 at 06:32:30PM -0700, Jon Forrest wrote:\n\n> I know how to see the checksums of the files in an index\n> file. But, I can't find a git command that shows the\n> checksum at the end of an index file.\n\nI don't think that there's a command to do so (likewise for other\nchecksum'd files like pack idx, etc). We'd usually check those during\nfsck but I don't know of any specific command to print them. I'd usually\ndo something like:\n\n   fn=.git/index\n   size=$(stat --format=%s $fn)\n   # offset of hash; use 32 in a sha256 repo!\n   hash=$((size - 20))\n   # the computed hash\n   dd if=$fn bs=1 count=$hash | sha1sum\n   # what the file records\n   dd if=$fn bs=1 skip=$hash | od -A none -t x1 | tr -d ' \\n'\n\nWhich admittedly is kind of horrible, but this isn't generally needed\nmuch outside of debugging.\n\n-Peff\n"}]}