git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Peter Eriksen <s022018@student.dtu.dk>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Update, and clear up the pack format documentation a bit
Date: Sun, 6 Apr 2008 00:51:32 -0400	[thread overview]
Message-ID: <20080406045132.GA10274@spearce.org> (raw)
In-Reply-To: <20080405180759.GA29710@bohr.gbar.dtu.dk>

Peter Eriksen <s022018@student.dtu.dk> wrote:
> The current documentation does not mention the ofs_delta pack
> object type. This patch is also supposed to make the text a bit
> more readable, since it moves the object entry header
> description earlier.
...
> diff --git a/Documentation/technical/pack-format.txt
> b/Documentation/technical/pack-format.txt
> index aa87756..35ee01d 100644
> --- a/Documentation/technical/pack-format.txt
> +++ b/Documentation/technical/pack-format.txt
>       compressed delta data
> + 
> +     (for object type ofs_delta)
> +     n-byte offset (n*7-bit as above, but with size0 being 7 bit)     
> +     compressed delta data
> +

That is not correct.  The ofs_delta is encoded as an n-byte offset
that is subtracted from the current object's first byte (the byte
holding the type/representation field and first 4 bits of length).

The n-byte encoding for an ofs_delta is different then the one
used for the length.  We add 1 for each byte where the MSB is 1.
We also store the data in big-endian form (the most significant
byte is first and the least significant byte is last).

See get_delta_base in sha1_file.c for the details of this.

In pack v4 I planned on using this particular encoding in more
of the format than just here.

-- 
Shawn.

  parent reply	other threads:[~2008-04-06  4:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 18:07 [PATCH] Update, and clear up the pack format documentation a bit Peter Eriksen
2008-04-05 23:58 ` Junio C Hamano
2008-04-06  4:51 ` Shawn O. Pearce [this message]
2008-04-06  6:16   ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080406045132.GA10274@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=s022018@student.dtu.dk \
    /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.
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 NNTP newsgroup(s).