git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/5] index-format.txt: document SHA-256 index format

From
Derrick Stolee <stolee@gmail.com>
Date
Aug 14, 2020, 12:28 UTC
Message-ID
<e9963ef1-cecd-cdf8-a5cf-2be884d8ced6@gmail.com>
In-Reply-To
<e811455d55cdb222a85d880f3cf3d5e28a8d4c91.1597406877.git.martin.agren@gmail.com>
On 8/14/2020 8:21 AM, Martin Ågren wrote:
Show 34 quoted lines
> Similar to a recent commit, document that in SHA-1 repositories, we use
> SHA-1 and in SHA-256 repositories, we use SHA-256, then replace all
> other uses of "SHA-1" with something more neutral.
> 
> Signed-off-by: Martin Ågren <martin.agren@gmail.com>
> ---
>  Documentation/technical/index-format.txt | 27 +++++++++++++-----------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt
> index faa25c5c52..827ece2ed1 100644
> --- a/Documentation/technical/index-format.txt
> +++ b/Documentation/technical/index-format.txt
> @@ -3,8 +3,11 @@ Git index format
>  
>  == The Git index file has the following format
>  
> -  All binary numbers are in network byte order. Version 2 is described
> -  here unless stated otherwise.
> +  All binary numbers are in network byte order.
> +  In a repository using the traditional SHA-1, checksums and object IDs
> +  (object names) mentioned below are all computed using SHA-1.  Similarly,
> +  in SHA-256 repositories, these values are computed using SHA-256.
> +  Version 2 is described here unless stated otherwise.
>  
>     - A 12-byte header consisting of
>  
> @@ -32,7 +35,7 @@ Git index format
>  
>       Extension data
>  
> -   - 160-bit SHA-1 over the content of the index file before this
> +   - 160-bit hash checksum over the content of the index file before this
>       checksum.
If this hash is flexible, then "160-bit" is not correct anymore, right?
Show 7 quoted lines
>  == Index entry
> @@ -80,7 +83,7 @@ Git index format
>    32-bit file size
>      This is the on-disk size from stat(2), truncated to 32-bit.
>  
> -  160-bit SHA-1 for the represented object
> +  160-bit object name for the represented object
Same here. The later instances of "160-bit" were dropped.
Show 58 quoted lines
>    A 16-bit 'flags' field split into (high to low bits)
>  
> @@ -211,8 +214,8 @@ Git index format
>  
>    The extension consists of:
>  
> -  - 160-bit SHA-1 of the shared index file. The shared index file path
> -    is $GIT_DIR/sharedindex.<SHA-1>. If all 160 bits are zero, the
> +  - Hash of the shared index file. The shared index file path
> +    is $GIT_DIR/sharedindex.<hash>. If all bits are zero, the
>      index does not require a shared index file.
>  
>    - An ewah-encoded delete bitmap, each bit represents an entry in the
> @@ -253,10 +256,10 @@ Git index format
>  
>    - 32-bit dir_flags (see struct dir_struct)
>  
> -  - 160-bit SHA-1 of $GIT_DIR/info/exclude. Null SHA-1 means the file
> +  - Hash of $GIT_DIR/info/exclude. A null hash means the file
>      does not exist.
>  
> -  - 160-bit SHA-1 of core.excludesfile. Null SHA-1 means the file does
> +  - Hash of core.excludesfile. A null hash means the file does
>      not exist.
>  
>    - NUL-terminated string of per-dir exclude file name. This usually
> @@ -285,13 +288,13 @@ The remaining data of each directory block is grouped by type:
>    - An ewah bitmap, the n-th bit records "check-only" bit of
>      read_directory_recursive() for the n-th directory.
>  
> -  - An ewah bitmap, the n-th bit indicates whether SHA-1 and stat data
> +  - An ewah bitmap, the n-th bit indicates whether hash and stat data
>      is valid for the n-th directory and exists in the next data.
>  
>    - An array of stat data. The n-th data corresponds with the n-th
>      "one" bit in the previous ewah bitmap.
>  
> -  - An array of SHA-1. The n-th SHA-1 corresponds with the n-th "one" bit
> +  - An array of hashes. The n-th hash corresponds with the n-th "one" bit
>      in the previous ewah bitmap.
>  
>    - One NUL.
> @@ -330,12 +333,12 @@ The remaining data of each directory block is grouped by type:
>  
>    - 32-bit offset to the end of the index entries
>  
> -  - 160-bit SHA-1 over the extension types and their sizes (but not
> +  - Hash over the extension types and their sizes (but not
>  	their contents).  E.g. if we have "TREE" extension that is N-bytes
>  	long, "REUC" extension that is M-bytes long, followed by "EOIE",
>  	then the hash would be:
>  
> -	SHA-1("TREE" + <binary representation of N> +
> +	Hash("TREE" + <binary representation of N> +
>  		"REUC" + <binary representation of M>)
>  
>  == Index Entry Offset Table
> 

Thanks, -Stolee

Previous: Martin ÅgrenNext: Martin Ågren
Message 28 of 35 in “Documentation updates for SHA-256”
  1. 0/2 Documentation updates for SHA-256brian m. carlson, Aug 13, 2020
  2. 1/2 docs: document SHA-256 pack and indicesbrian m. carlson, Aug 13, 2020
  3. Derrick StoleeAug 14, 2020
  4. 2/2 docs: fix step in transition planbrian m. carlson, Aug 13, 2020
  5. Martin ÅgrenAug 14, 2020
  6. Derrick StoleeAug 14, 2020
  7. Junio C HamanoAug 14, 2020
  8. brian m. carlsonAug 14, 2020
  9. Junio C HamanoAug 14, 2020
  10. 0/5 more SHA-256 documentationMartin Ågren, Aug 14, 2020
  11. 1/5 http-protocol.txt: document SHA-256 "want"/"have" formatMartin Ågren, Aug 14, 2020
  12. Junio C HamanoAug 14, 2020
  13. brian m. carlsonAug 14, 2020
  14. Martin ÅgrenAug 14, 2020
  15. Junio C HamanoAug 14, 2020
  16. Junio C HamanoAug 14, 2020
  17. 4/5 shallow.txt: document SHA-256 shallow formatMartin Ågren, Aug 14, 2020
  18. 3/5 protocol-capabilities.txt: clarify "allow-x-sha1-in-want" re SHA-256Martin Ågren, Aug 14, 2020
  19. Derrick StoleeAug 14, 2020
  20. Martin ÅgrenAug 14, 2020
  21. Junio C HamanoAug 14, 2020
  22. Martin ÅgrenAug 14, 2020
  23. Junio C HamanoAug 14, 2020
  24. 5/5 commit-graph-format.txt: fix "Hash Version" descriptionMartin Ågren, Aug 14, 2020
  25. Derrick StoleeAug 14, 2020
  26. Martin ÅgrenAug 14, 2020
  27. 2/5 index-format.txt: document SHA-256 index formatMartin Ågren, Aug 14, 2020
  28. Derrick StoleeAug 14, 2020
  29. Martin ÅgrenAug 14, 2020
  30. brian m. carlsonAug 14, 2020
  31. 0/4 more SHA-256 documentationMartin Ågren, Aug 15, 2020
  32. 2/4 index-format.txt: document SHA-256 index formatMartin Ågren, Aug 15, 2020
  33. 3/4 protocol-capabilities.txt: clarify "allow-x-sha1-in-want" re SHA-256Martin Ågren, Aug 15, 2020
  34. 4/4 shallow.txt: document SHA-256 shallow formatMartin Ågren, Aug 15, 2020
  35. 1/4 http-protocol.txt: document SHA-256 "want"/"have" formatMartin Ågren, Aug 15, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.