Code

Merge branch 'maint'
[git.git] / Documentation / technical / pack-format.txt
index ed2decc107d374b07e9ce91fa755617790672743..e5b31c81fa3b5268c6d1bc0afcaec967f401ac28 100644 (file)
@@ -5,8 +5,13 @@ GIT pack format
 
    - The header appears at the beginning and consists of the following:
 
-     4-byte signature
-     4-byte version number (network byte order)
+     4-byte signature:
+         The signature is: {'P', 'A', 'C', 'K'}
+
+     4-byte version number (network byte order):
+         GIT currently accepts version number 2 or 3 but
+         generates version 2 only.
+
      4-byte number of objects contained in the pack (network byte order)
 
      Observation: we cannot have more than 4G versions ;-) and
@@ -16,11 +21,11 @@ GIT pack format
      which looks like this:
 
      (undeltified representation)
-     n-byte type and length (4-bit type, (n-1)*7+4-bit length)
+     n-byte type and length (3-bit type, (n-1)*7+4-bit length)
      compressed data
 
      (deltified representation)
-     n-byte type and length (4-bit type, (n-1)*7+4-bit length)
+     n-byte type and length (3-bit type, (n-1)*7+4-bit length)
      20-byte base object name
      compressed delta data
 
@@ -41,7 +46,7 @@ GIT pack format
     8-byte integers to go beyond 4G objects per pack, but it is
     not strictly necessary.
 
-  - The header is followed by sorted 28-byte entries, one entry
+  - The header is followed by sorted 24-byte entries, one entry
     per object in the pack.  Each entry is:
 
     4-byte network byte order integer, recording where the
@@ -75,7 +80,7 @@ Pack Idx file:
            +--------------------------------+ |
 main       | offset                         | |
 index      | object name 00XXXXXXXXXXXXXXXX | |
-table      +--------------------------------+ | 
+table      +--------------------------------+ |
            | offset                         | |
            | object name 00XXXXXXXXXXXXXXXX | |
            +--------------------------------+ |
@@ -92,20 +97,22 @@ trailer       | | packfile checksum              |
          | +--------------------------------+
          | | idxfile checksum               |
          | +--------------------------------+
-          .-------.      
+          .-------.
                   |
 Pack file entry: <+
 
      packed object header:
-       1-byte type (upper 4-bit)
-              size0 (lower 4-bit) 
+       1-byte size extension bit (MSB)
+              type (next 3 bit)
+              size0 (lower 4-bit)
         n-byte sizeN (as long as MSB is set, each 7-bit)
                size0..sizeN form 4+7+7+..+7 bit integer, size0
-               is the most significant part.
+               is the least significant part, and sizeN is the
+               most significant part.
      packed object data:
         If it is not DELTA, then deflated bytes (the size above
                is the size before compression).
        If it is DELTA, then
          20-byte base object name SHA1 (the size above is the
-               size of the delta data that follows).
+               size of the delta data that follows).
           delta data, deflated.