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

Re: Understanding pack format

From
Jeff King <peff@peff.net>
Date
Nov 6, 2018, 06:09 UTC
Message-ID
<20181106060919.GA17521@sigill.intra.peff.net>
In-Reply-To
<CAFd4kYDcX2BOYvMg1X9zO68EfYYE6Zke_-9CGY-Yi01jCc3EPA@mail.gmail.com>
On Mon, Nov 05, 2018 at 09:23:45PM -0500, Farhan Khan wrote:
Show 9 quoted lines
> I am trying to identify where the content from a pack comes from. I
> traced it back to sha1-file.c:read_object(), which will return the
> 'content'. I want to know where the 'content' comes from, which seems
> to come from sha1-file.c:oid_object_info_extended. This goes into
> packfile.c:find_pack_entry(), but from here I get lost. I do not
> understand what is happening.
> 
> How does it retrieve the pack content? I am lost here. Please assist.
> This is in the technical git documentation, but it was not clear.

After find_pack_entry() tells us the object is in a pack, we end up in packed_object_info(). Depending what the caller is asking for, there are a couple different strategies (because we try to avoid loading the whole object if we don't need it).

Probably the one you're interested in is just grabbing the content, which happens via cache_or_unpack_entry(). The cached case is less interesting, so try unpack_entry(), which is what actually reads the bytes out of the packfile.

-Peff
Previous: Farhan KhanNext: Duy Nguyen
Message 5 of 7 in “Understanding pack format”
  1. Farhan KhanNov 2, 2018
  2. Junio C HamanoNov 2, 2018
  3. Duy NguyenNov 2, 2018
  4. Farhan KhanNov 6, 2018
  5. Jeff KingNov 6, 2018
  6. Duy NguyenNov 6, 2018
  7. Duy NguyenNov 2, 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.