Skip to content

Commit 74a395c

Browse files
committed
Merge branch 'ma/sha-256-docs'
Further update of docs to adjust to the recent SHA-256 work. * ma/sha-256-docs: shallow.txt: document SHA-256 shallow format protocol-capabilities.txt: clarify "allow-x-sha1-in-want" re SHA-256 index-format.txt: document SHA-256 index format http-protocol.txt: document SHA-256 "want"/"have" format
2 parents 2a978f8 + 8afa50a commit 74a395c

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

Documentation/technical/http-protocol.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ at all in the request stream:
401401
The stream is terminated by a pkt-line flush (`0000`).
402402

403403
A single "want" or "have" command MUST have one hex formatted
404-
SHA-1 as its value. Multiple SHA-1s MUST be sent by sending
405-
multiple commands.
404+
object name as its value. Multiple object names MUST be sent by sending
405+
multiple commands. Object names MUST be given using the object format
406+
negotiated through the `object-format` capability (default SHA-1).
406407

407408
The `have` list is created by popping the first 32 commits
408409
from `c_pending`. Less can be supplied if `c_pending` empties.

Documentation/technical/index-format.txt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ Git index format
33

44
== The Git index file has the following format
55

6-
All binary numbers are in network byte order. Version 2 is described
7-
here unless stated otherwise.
6+
All binary numbers are in network byte order.
7+
In a repository using the traditional SHA-1, checksums and object IDs
8+
(object names) mentioned below are all computed using SHA-1. Similarly,
9+
in SHA-256 repositories, these values are computed using SHA-256.
10+
Version 2 is described here unless stated otherwise.
811

912
- A 12-byte header consisting of
1013

@@ -32,8 +35,7 @@ Git index format
3235

3336
Extension data
3437

35-
- 160-bit SHA-1 over the content of the index file before this
36-
checksum.
38+
- Hash checksum over the content of the index file before this checksum.
3739

3840
== Index entry
3941

@@ -80,7 +82,7 @@ Git index format
8082
32-bit file size
8183
This is the on-disk size from stat(2), truncated to 32-bit.
8284

83-
160-bit SHA-1 for the represented object
85+
Object name for the represented object
8486

8587
A 16-bit 'flags' field split into (high to low bits)
8688

@@ -160,8 +162,8 @@ Git index format
160162

161163
- A newline (ASCII 10); and
162164

163-
- 160-bit object name for the object that would result from writing
164-
this span of index as a tree.
165+
- Object name for the object that would result from writing this span
166+
of index as a tree.
165167

166168
An entry can be in an invalidated state and is represented by having
167169
a negative number in the entry_count field. In this case, there is no
@@ -198,7 +200,7 @@ Git index format
198200
stage 1 to 3 (a missing stage is represented by "0" in this field);
199201
and
200202

201-
- At most three 160-bit object names of the entry in stages from 1 to 3
203+
- At most three object names of the entry in stages from 1 to 3
202204
(nothing is written for a missing stage).
203205

204206
=== Split index
@@ -211,8 +213,8 @@ Git index format
211213

212214
The extension consists of:
213215

214-
- 160-bit SHA-1 of the shared index file. The shared index file path
215-
is $GIT_DIR/sharedindex.<SHA-1>. If all 160 bits are zero, the
216+
- Hash of the shared index file. The shared index file path
217+
is $GIT_DIR/sharedindex.<hash>. If all bits are zero, the
216218
index does not require a shared index file.
217219

218220
- An ewah-encoded delete bitmap, each bit represents an entry in the
@@ -253,10 +255,10 @@ Git index format
253255

254256
- 32-bit dir_flags (see struct dir_struct)
255257

256-
- 160-bit SHA-1 of $GIT_DIR/info/exclude. Null SHA-1 means the file
258+
- Hash of $GIT_DIR/info/exclude. A null hash means the file
257259
does not exist.
258260

259-
- 160-bit SHA-1 of core.excludesfile. Null SHA-1 means the file does
261+
- Hash of core.excludesfile. A null hash means the file does
260262
not exist.
261263

262264
- NUL-terminated string of per-dir exclude file name. This usually
@@ -285,13 +287,13 @@ The remaining data of each directory block is grouped by type:
285287
- An ewah bitmap, the n-th bit records "check-only" bit of
286288
read_directory_recursive() for the n-th directory.
287289

288-
- An ewah bitmap, the n-th bit indicates whether SHA-1 and stat data
290+
- An ewah bitmap, the n-th bit indicates whether hash and stat data
289291
is valid for the n-th directory and exists in the next data.
290292

291293
- An array of stat data. The n-th data corresponds with the n-th
292294
"one" bit in the previous ewah bitmap.
293295

294-
- An array of SHA-1. The n-th SHA-1 corresponds with the n-th "one" bit
296+
- An array of hashes. The n-th hash corresponds with the n-th "one" bit
295297
in the previous ewah bitmap.
296298

297299
- One NUL.
@@ -330,12 +332,12 @@ The remaining data of each directory block is grouped by type:
330332

331333
- 32-bit offset to the end of the index entries
332334

333-
- 160-bit SHA-1 over the extension types and their sizes (but not
335+
- Hash over the extension types and their sizes (but not
334336
their contents). E.g. if we have "TREE" extension that is N-bytes
335337
long, "REUC" extension that is M-bytes long, followed by "EOIE",
336338
then the hash would be:
337339

338-
SHA-1("TREE" + <binary representation of N> +
340+
Hash("TREE" + <binary representation of N> +
339341
"REUC" + <binary representation of M>)
340342

341343
== Index Entry Offset Table

Documentation/technical/protocol-capabilities.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,19 @@ allow-tip-sha1-in-want
324324
----------------------
325325

326326
If the upload-pack server advertises this capability, fetch-pack may
327-
send "want" lines with SHA-1s that exist at the server but are not
328-
advertised by upload-pack.
327+
send "want" lines with object names that exist at the server but are not
328+
advertised by upload-pack. For historical reasons, the name of this
329+
capability contains "sha1". Object names are always given using the
330+
object format negotiated through the 'object-format' capability.
329331

330332
allow-reachable-sha1-in-want
331333
----------------------------
332334

333335
If the upload-pack server advertises this capability, fetch-pack may
334-
send "want" lines with SHA-1s that exist at the server but are not
335-
advertised by upload-pack.
336+
send "want" lines with object names that exist at the server but are not
337+
advertised by upload-pack. For historical reasons, the name of this
338+
capability contains "sha1". Object names are always given using the
339+
object format negotiated through the 'object-format' capability.
336340

337341
push-cert=<nonce>
338342
-----------------

Documentation/technical/shallow.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pretend as if they are root commits (e.g. "git log" traversal
1313
stops after showing them; "git fsck" does not complain saying
1414
the commits listed on their "parent" lines do not exist).
1515

16-
Each line contains exactly one SHA-1. When read, a commit_graft
16+
Each line contains exactly one object name. When read, a commit_graft
1717
will be constructed, which has nr_parent < 0 to make it easier
1818
to discern from user provided grafts.
1919

0 commit comments

Comments
 (0)