Re: [PATCH v2] pack-format.txt: more details on pack file format
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 11, 2018, 06:41 UTC
- Message-ID
- <CACsJy8Btz_yYzdMds5SsJ+roSHj4RgiN4eCuPOh0+fod3e2mpw@mail.gmail.com>
- In-Reply-To
- <CAGZ79kYYFBE+39aeHX22w3ARmujFcgE8YDUQpp6Hps264r0wfQ@mail.gmail.com>
On Thu, May 10, 2018 at 7:06 PM, Stefan Beller <sbeller@google.com> wrote:
Show 11 quoted lines
>> +=== Deltified representation >> + >> +Conceptually there are only four object types: commit, tree, tag and >> +blob. However to save space, an object could be stored as a "delta" of >> +another "base" object. These representations are assigned new types >> +ofs-delta and ref-delta, which is only valid in a pack file. > > ...only valid... > > as opposed to loose objects or as opposed to referencing cross-packs? > I would think the former, not the latter.
Yeah. This is pretty much an implementation detail of a pack. The "real" type is always blob/commit/tree/tag. But you only see this when you dig deep down in pack-related code.
Show 8 quoted lines
>> +Both ofs-delta and ref-delta store the "delta" against another >> +object. The difference between them is, ref-delta directly encodes >> +20-byte base object name. If the base object is in the same pack, >> +ofs-delta encodes the offset of the base object in the pack instead. > > Reading this paragraph clears up the question from before. > The ref delta is a delta to another "reference by hash id (sha1)". > What abbreviation is OFS? OFfSet ?
I guess so. I never bothered to track down the source for that.
Show 7 quoted lines
>> +The delta data is a sequence of instructions to reconstruct an object >> +from the base object. > > As said before the base object is of type 1..4, we do not "delta-on-delta" > yet, but to construct the object we have to create the base object first, > which itself can be represented as a deltified object leading to a delta > chain.
Yeah that's the delta chain concept. I'll just make a note here about base object potentially being a delta object as well.
-- Duy