Skip to content

Commit 336fbd1

Browse files
committed
Merge branch 'bc/sha-256-doc-updates'
Further update of docs to adjust to the recent SHA-256 work. * bc/sha-256-doc-updates: docs: fix step in transition plan docs: document SHA-256 pack and indices
2 parents ee356a8 + 2ae12e5 commit 336fbd1

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

Documentation/technical/hash-function-transition.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,14 @@ Some initial steps can be implemented independently of one another:
650650

651651
The first user-visible change is the introduction of the objectFormat
652652
extension (without compatObjectFormat). This requires:
653-
- implementing the loose-object-idx
654653
- teaching fsck about this mode of operation
655654
- using the hash function API (vtable) when computing object names
656655
- signing objects and verifying signatures
657656
- rejecting attempts to fetch from or push to an incompatible
658657
repository
659658

660659
Next comes introduction of compatObjectFormat:
660+
- implementing the loose-object-idx
661661
- translating object names between object formats
662662
- translating object content between object formats
663663
- generating and verifying signatures in the compat format

Documentation/technical/pack-format.txt

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Git pack format
22
===============
33

4+
== Checksums and object IDs
5+
6+
In a repository using the traditional SHA-1, pack checksums, index checksums,
7+
and object IDs (object names) mentioned below are all computed using SHA-1.
8+
Similarly, in SHA-256 repositories, these values are computed using SHA-256.
9+
410
== pack-*.pack files have the following format:
511

612
- A header appears at the beginning and consists of the following:
@@ -26,15 +32,15 @@ Git pack format
2632

2733
(deltified representation)
2834
n-byte type and length (3-bit type, (n-1)*7+4-bit length)
29-
20-byte base object name if OBJ_REF_DELTA or a negative relative
35+
base object name if OBJ_REF_DELTA or a negative relative
3036
offset from the delta object's position in the pack if this
3137
is an OBJ_OFS_DELTA object
3238
compressed delta data
3339

3440
Observation: length of each object is encoded in a variable
3541
length format and is not constrained to 32-bit or anything.
3642

37-
- The trailer records 20-byte SHA-1 checksum of all of the above.
43+
- The trailer records a pack checksum of all of the above.
3844

3945
=== Object types
4046

@@ -58,8 +64,8 @@ ofs-delta and ref-delta, which is only valid in a pack file.
5864

5965
Both ofs-delta and ref-delta store the "delta" to be applied to
6066
another object (called 'base object') to reconstruct the object. The
61-
difference between them is, ref-delta directly encodes 20-byte base
62-
object name. If the base object is in the same pack, ofs-delta encodes
67+
difference between them is, ref-delta directly encodes base object
68+
name. If the base object is in the same pack, ofs-delta encodes
6369
the offset of the base object in the pack instead.
6470

6571
The base object could also be deltified if it's in the same pack.
@@ -143,14 +149,14 @@ This is the instruction reserved for future expansion.
143149
object is stored in the packfile as the offset from the
144150
beginning.
145151

146-
20-byte object name.
152+
one object name of the appropriate size.
147153

148154
- The file is concluded with a trailer:
149155

150-
A copy of the 20-byte SHA-1 checksum at the end of
151-
corresponding packfile.
156+
A copy of the pack checksum at the end of the corresponding
157+
packfile.
152158

153-
20-byte SHA-1-checksum of all of the above.
159+
Index checksum of all of the above.
154160

155161
Pack Idx file:
156162

@@ -198,7 +204,7 @@ Pack file entry: <+
198204
If it is not DELTA, then deflated bytes (the size above
199205
is the size before compression).
200206
If it is REF_DELTA, then
201-
20-byte base object name SHA-1 (the size above is the
207+
base object name (the size above is the
202208
size of the delta data that follows).
203209
delta data, deflated.
204210
If it is OFS_DELTA, then
@@ -227,9 +233,9 @@ Pack file entry: <+
227233

228234
- A 256-entry fan-out table just like v1.
229235

230-
- A table of sorted 20-byte SHA-1 object names. These are
231-
packed together without offset values to reduce the cache
232-
footprint of the binary search for a specific object name.
236+
- A table of sorted object names. These are packed together
237+
without offset values to reduce the cache footprint of the
238+
binary search for a specific object name.
233239

234240
- A table of 4-byte CRC32 values of the packed object data.
235241
This is new in v2 so compressed data can be copied directly
@@ -248,10 +254,10 @@ Pack file entry: <+
248254

249255
- The same trailer as a v1 pack file:
250256

251-
A copy of the 20-byte SHA-1 checksum at the end of
257+
A copy of the pack checksum at the end of
252258
corresponding packfile.
253259

254-
20-byte SHA-1-checksum of all of the above.
260+
Index checksum of all of the above.
255261

256262
== multi-pack-index (MIDX) files have the following format:
257263

@@ -329,4 +335,4 @@ CHUNK DATA:
329335

330336
TRAILER:
331337

332-
20-byte SHA1-checksum of the above contents.
338+
Index checksum of the above contents.

0 commit comments

Comments
 (0)