Re: [PATCH v2] Add description of OFS_DELTA to the pack format description
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 6, 2008, 20:28 UTC
- Message-ID
- <20080406202821.GN10274@spearce.org>
- In-Reply-To
- <20080406201907.GB7075@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..953c7ee 100644 > --- a/Documentation/technical/pack-format.txt > +++ b/Documentation/technical/pack-format.txt > @@ -103,10 +103,24 @@ 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) counted from the type-byte > + of the header of the ofs-delta entry.
Except that only a positive offset value is here, as it is always a treated as a negative offset (you can only refer to a base that was before you, as that is the only way to know the base's offset in the pack).
Show 10 quoted lines
> + (the size above is the size of the delta data > + that follows). > + delta data, deflated. > + > + 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 > + for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1)) > + to the result.
Yes, that sounds correct.
-- Shawn.