Skip to content

Commit 7b77f5a

Browse files
Martin Ågrengitster
authored andcommitted
pack-format.txt: document sizes at start of delta data
We document the delta data as a set of instructions, but forget to document the two sizes that precede those instructions: the size of the base object and the size of the object to be reconstructed. Fix this omission. Rather than cramming all the details about the encoding into the running text, introduce a separate section detailing our "size encoding" and refer to it. Reported-by: Ross Light <[email protected]> Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 898f807 commit 7b77f5a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Documentation/technical/pack-format.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ Valid object types are:
5555

5656
Type 5 is reserved for future expansion. Type 0 is invalid.
5757

58+
=== Size encoding
59+
60+
This document uses the following "size encoding" of non-negative
61+
integers: From each byte, the seven least significant bits are
62+
used to form the resulting integer. As long as the most significant
63+
bit is 1, this process continues; the byte with MSB 0 provides the
64+
last seven bits. The seven-bit chunks are concatenated. Later
65+
values are more significant.
66+
67+
This size encoding should not be confused with the "offset encoding",
68+
which is also used in this document.
69+
5870
=== Deltified representation
5971

6072
Conceptually there are only four object types: commit, tree, tag and
@@ -73,7 +85,10 @@ Ref-delta can also refer to an object outside the pack (i.e. the
7385
so-called "thin pack"). When stored on disk however, the pack should
7486
be self contained to avoid cyclic dependency.
7587

76-
The delta data is a sequence of instructions to reconstruct an object
88+
The delta data starts with the size of the base object and the
89+
size of the object to be reconstructed. These sizes are
90+
encoded using the size encoding from above. The remainder of
91+
the delta data is a sequence of instructions to reconstruct the object
7792
from the base object. If the base object is deltified, it must be
7893
converted to canonical form first. Each instruction appends more and
7994
more data to the target object until it's complete. There are two

0 commit comments

Comments
 (0)