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

How DELTA objects values work and are calculated

From
FKFarhan Khan <khanzf@gmail.com>
Date
Jan 5, 2019, 02:48 UTC
Message-ID
<CAFd4kYBX+HrLxbga=VJgC5WjyeDZEznm2UCL+HF8A1YKVo3Trw@mail.gmail.com>
Hi all,

I'm having trouble understanding how OBJ_REF_DELTA and OBJ_REF_DELTA (deltas) work in git. Where does git calculate the sha1 hash values when doing "git index-pack" in builtin/index-pack.c. I think my lack of understanding of the code is compounded the fact that I do not understand what the two object types are.

From tracing the code starting from index-pack, all non-delta object type hashes are calculated in index-pack.c:1131 (parse_pack_objects). However, when the function ends, the delta objects hash values are set to all 0's.

My questions are: A) How do Delta objects work? B) Where and how are the sha1 values calculated?

I have read Documentation/technical/pack-format.txt, but am still not clear.

Thank you! -- Farhan Khan PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE

Next: Duy Nguyen
Message 1 of 4 in “How DELTA objects values work and are calculated”
  1. Farhan KhanJan 5, 2019
  2. Duy NguyenJan 5, 2019
  3. Farhan KhanJan 5, 2019
  4. Duy NguyenJan 6, 2019

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.