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

Re: [PATCH] Add description of OFS_DELTA to the pack format description

From
Shawn O. Pearce <spearce@spearce.org>
Date
Apr 6, 2008, 19:07 UTC
Message-ID
<20080406190724.GG10274@spearce.org>
In-Reply-To
<20080406134739.GA29815@bohr.gbar.dtu.dk>
Peter Eriksen <s022018@student.dtu.dk> wrote:
Show 17 quoted lines
> diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
> index aa87756..f6b1405 100644
> --- a/Documentation/technical/pack-format.txt
> +++ b/Documentation/technical/pack-format.txt
> @@ -103,10 +103,20 @@ Pack file entry: <+
>       packed object data:
>          If it is not DELTA, then deflated bytes (the size above
>  		is the size before compression).
> -	If it is DELTA, then
> +	If it is REF_DELTA, then
>  	  20-byte base object name SHA1 (the size above is the
>  		size of the delta data that follows).
>            delta data, deflated.
> +	If it is OFS_DELTA, then
> +	  n-byte offset (see below) (the size above is the
> +		size of the delta data that follows).
> +          delta data, deflated.

You are missing the description that the position within _this_ packfile is determined by:

	offset_of_type_byte - n_byte_offset

The above can still be taken to mean the offset is from the start of the packfile or something like that.

Show 5 quoted lines
> +     offset encoding:
> +          n bytes with MSB set in all but the last one.
> +          The offset is then the number constructed by
> +          concatenating the lower 7 bit of each byte, and
> +          adding 2^7 + 2^14 + ... + 2^(7*(n-1)) to the result.

Hmm. I've just spent 5 minutes reading this and I'm still not certain what the result is. 2^0 only gets added to the result if there is at least 2 bytes of data in the offset encoding; in your description above it sounds like we should add 2^0 (1) even when there is only 1 offset byte (n=1), which is not correct.

-- 
Shawn.
Previous: Peter EriksenNext: Peter Eriksen
Message 2 of 6 in “Add description of OFS_DELTA to the pack format description”
  1. Add description of OFS_DELTA to the pack format descriptionPeter Eriksen, Apr 6, 2008
  2. Shawn O. PearceApr 6, 2008
  3. Add description of OFS_DELTA to the pack format descriptionPeter Eriksen, Apr 6, 2008
  4. Shawn O. PearceApr 6, 2008
  5. Add description of OFS_DELTA to the pack format descriptionPeter Eriksen, Apr 6, 2008
  6. Shawn O. PearceApr 6, 2008

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.