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

Re: [PATCH 09/12] read-cache: abstract away uses of SHA-1

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 28, 2018, 19:50 UTC
Message-ID
<CAPig+cQ6UZJh5sZJURTiZ+T8eV8pyBSMTM8Re-BN7ZVwGc60+A@mail.gmail.com>
In-Reply-To
<20180128155722.880805-10-sandals@crustytoothpaste.net>

On Sun, Jan 28, 2018 at 10:57 AM, brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 9 quoted lines
> Convert various uses of direct calls to SHA-1 and 20- and 40-based
> constants to use the_hash_algo instead.  Don't yet convert the on-disk
> data structures, which will be handled in a future commit.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> diff --git a/read-cache.c b/read-cache.c
> @@ -2000,26 +2000,26 @@ static int write_index_ext_header(git_SHA_CTX *context, int fd,
>         /* Flush first if not enough space for SHA1 signature */

Did you want to update the comment to remove the SHA1 reference also? (Or was the omission intentional per the commit message?)

Show 8 quoted lines
> -       if (left + 20 > WRITE_BUFFER_SIZE) {
> +       if (left + the_hash_algo->rawsz > WRITE_BUFFER_SIZE) {
>                 if (write_in_full(fd, write_buffer, left) < 0)
>                         return -1;
>                 left = 0;
>         }
>
>         /* Append the SHA1 signature at the end */
Ditto.
Show 6 quoted lines
> -       git_SHA1_Final(write_buffer + left, context);
> -       hashcpy(sha1, write_buffer + left);
> -       left += 20;
> +       the_hash_algo->final_fn(write_buffer + left, context);
> +       hashcpy(hash, write_buffer + left);
> +       left += the_hash_algo->rawsz;
Previous: brian m. carlsonNext: brian m. carlson
Message 8 of 22 in “object_id part 11 (the_hash_algo)”
  1. 00/12 object_id part 11 (the_hash_algo)brian m. carlson, Jan 28, 2018
  2. 01/12 hash: move SHA-1 macros to hash.hbrian m. carlson, Jan 28, 2018
  3. 04/12 builtin/unpack-objects: switch uses of SHA-1 to the_hash_algobrian m. carlson, Jan 28, 2018
  4. 05/12 sha1_file: switch uses of SHA-1 to the_hash_algobrian m. carlson, Jan 28, 2018
  5. 06/12 fast-import: switch various uses of SHA-1 to the_hash_algobrian m. carlson, Jan 28, 2018
  6. Patryk ObaraJan 28, 2018
  7. 09/12 read-cache: abstract away uses of SHA-1brian m. carlson, Jan 28, 2018
  8. Eric SunshineJan 28, 2018
  9. brian m. carlsonJan 28, 2018
  10. 12/12 bulk-checkin: abstract SHA-1 usagebrian m. carlson, Jan 28, 2018
  11. 03/12 builtin/index-pack: improve hash function abstractionbrian m. carlson, Jan 28, 2018
  12. 11/12 csum-file: abstract uses of SHA-1brian m. carlson, Jan 28, 2018
  13. 10/12 csum-file: rename sha1file to hashfilebrian m. carlson, Jan 28, 2018
  14. 02/12 hash: create union for hash context allocationbrian m. carlson, Jan 28, 2018
  15. Patryk ObaraJan 28, 2018
  16. brian m. carlsonJan 28, 2018
  17. 07/12 pack-check: convert various uses of SHA-1 to abstract formsbrian m. carlson, Jan 28, 2018
  18. 08/12 pack-write: switch various SHA-1 values to abstract formsbrian m. carlson, Jan 28, 2018
  19. Patryk ObaraJan 28, 2018
  20. brian m. carlsonJan 28, 2018
  21. Patryk ObaraJan 28, 2018
  22. brian m. carlsonJan 28, 2018

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.