From: Erik Fastermann <erik@fastermann.de>
To: git@vger.kernel.org
Subject: Question about the pack OBJ_OFS_DELTA format
Date: Fri, 10 Jan 2020 09:26:27 +0100 (CET) [thread overview]
Message-ID: <1032627506.120165.1578644787174@email.ionos.de> (raw)
Hi all,
I'm trying to implement the Git pack format. Parsing the index file and
unpacking undeltified objects already works. However I'm unable to get
the offset, if the type is OBJ_OFS_DELTA.
The very much work-in-progress Go code and data can be found here:
https://github.com/erikfastermann/notes/tree/wip/git
From the docs (https://git-scm.com/docs/pack-format) I assume, that
the offset is a variable length integer, like the size. However my
caclulation leads to a illogical result.
When trying the hash 8c40ff4767d973b672fe5aa431cb8ba0593dd26a with:
git verify-pack -v pack.pack
I get: offset: 138650 size: 30.
The base object 9b25d441c1bf358af01edc4eeba65870581a5ac1 (shown by
verify-pack) has the offset 136887, which I think means the delta should
be: 138650 - 136887 = 1763.
Using the command:
dd skip=138650 count=4 if=pack.pack bs=1 status=none | hexdump -C
I get: ee 01 8c 63
The first two bytes, the type and the size are correctly computed.
So the next varint should be the offset.
8c: 10001100 --- 63: 01100011
-> 1100011_0001100
-> 12684 ???
The result is the same when calculating it manually and with my program.
I probably have some crucial misunderstanding about the format, so a
clarification would be nice.
Thank you for your help.
Erik
next reply other threads:[~2020-01-10 8:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 8:26 Erik Fastermann [this message]
2020-01-10 9:57 ` Question about the pack OBJ_OFS_DELTA format Jeff King
2020-01-10 13:56 ` Erik Fastermann
2020-01-10 19:41 ` Junio C Hamano
2020-01-11 9:56 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1032627506.120165.1578644787174@email.ionos.de \
--to=erik@fastermann.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).