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

How OBJ_REF_DELTA pack file size calculated

From
Farhan Khan <farhan@farhan.codes>
Date
Jan 20, 2024, 04:28 UTC
Message-ID
<afea6dc9-e557-4730-abe6-00947f77be06@app.fastmail.com>
Hi,
I am trying to implement REF_OBJ_DELTA, but having some trouble with offsets (sizes in the pack file) that do not align, specifically the size of the whole object does not seem to add up.
For example, consider this run:
git verify-pack -v .git/objects/pack/pack-48269bdfe1d28d20f603c6b23eed5717b7474e76.pack  | grep 82daab01f43e34b9f7c8e0db81a9951933b04f1b
82daab01f43e34b9f7c8e0db81a9951933b04f1b commit 94 101 82749 1 ecd0e8c88ed8891da372f5630d542150b0a0531e

The size of the object is 94 bytes The size of the entry is 101 bytes.

My patching/reconstruction of the object works, the compressed size is 97 bytes. However, I cannot figure out where the 101 comes from. The size of the object header is 2 bytes, the OBJ_REF_DELTA is 20 bytes (the SHA1), but that does not add up to 101 bytes.
I am trying to understand where the 101 bytes comes from.
If not, can you please point me to where in the code the offset size for OBJ_REF_DELTA is calculated. I tried myself from buildin/verify-pack.c, but there seems to be some multi-threating/processing going on and I was not able to determine where the calculation happens.

Thanks! -- Farhan Khan PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE

Next: Junio C Hamano
Message 1 of 2 in “How OBJ_REF_DELTA pack file size calculated”
  1. Farhan KhanJan 20, 2024
  2. Junio C HamanoJan 20, 2024

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.