git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: pack file object size question

From
Jeff King <peff@peff.net>
Date
Dec 17, 2018, 19:39 UTC
Message-ID
<20181217193949.GC9853@sigill.intra.peff.net>
In-Reply-To
<CAFd4kYCHefqRsiFK=K7MHp=MTwOBXB5979WobEm3w1J5q1bZ0w@mail.gmail.com>
On Sun, Dec 16, 2018 at 04:52:13PM -0500, Farhan Khan wrote:
> 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?

Others discussed the length confusion, but I wanted to point out one more thing: the packfile does not contain the sha1 of each object. That is computed by index-pack (but there is a sha1 of the contents of the _entire_ packfile).

A bit error on the wire will be detected by the whole-pack sha1. A bit error on the sender's disk generally be detected by zlib, but not always. The ultimate check that the receiver does is make sure it has all of the expected objects by walking the object graph from the proposed ref updates. Any object which has an undetected bit error will appear to be be missing (as well as any object that the sender actually just failed to send).

-Peff
Previous: Duy Nguyen
Message 6 of 6 in “pack file object size question”
  1. Farhan KhanDec 16, 2018
  2. Jonathan NiederDec 16, 2018
  3. Farhan KhanDec 16, 2018
  4. Jonathan NiederDec 17, 2018
  5. Duy NguyenDec 17, 2018
  6. Jeff KingDec 17, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.