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

Re: [PATCH 0/4] hash: introduce generic wrappers to update hash contexts

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 31, 2025, 18:16 UTC
Message-ID
<xmqqh65e97d8.fsf@gitster.g>
In-Reply-To
<20250131-b4-pks-hash-context-direct-v1-0-67a6d3f49d6e@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 27 quoted lines
> this patch series introduces a couple of generic wrappers to update hash
> contexts. Instead of updating contexts via function pointers provided by
> the hash algorithm, we now remember the hash algorithm in the context
> itself. As a result, subsequent calls that update the hash don't need to
> remember which algorithm they used:
>
>     ```
>     struct git_hash_ctx ctx;
>     struct object_id oid;
>
>     git_hash_sha1_init(&ctx);
>     git_hash_update(&ctx, data);
>     git_hash_final_oid(&oid, &ctx);
>     ```
>
> This was discussed in [1] and [2].
>
> The series is built on top of master at 3b0d05c4a7 (The fifth batch,
> 2025-01-29) with tb/unsafe-hashtcleanup at 04292c3796 (hash.h: drop
> unsafe_ function variants, 2025-01-23) merged into it.
>
> Thanks!
>
> Patrick
>
> [1]: <Z3fhK1ACzJfVehM2@pks.im>
> [2]: <Z4jyZCAwqOjZ-u2U@pks.im>
Sounds sensible.  

It seems to textually interact with Karthik's attempt to pass down a hash_algo instance through the callchain in pack-write.c but I should be able to resolve the conflicts.

Thanks.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 6 of 8 in “hash: introduce generic wrappers to update hash contexts”
  1. 0/4 hash: introduce generic wrappers to update hash contextsPatrick Steinhardt, Jan 31, 2025
  2. 1/4 hash: convert hashing context to a structurePatrick Steinhardt, Jan 31, 2025
  3. 2/4 hash: stop typedeffing the hash contextPatrick Steinhardt, Jan 31, 2025
  4. 3/4 hash: provide generic wrappers to update hash contextsPatrick Steinhardt, Jan 31, 2025
  5. 4/4 global: adapt callers to use generic hash context helpersPatrick Steinhardt, Jan 31, 2025
  6. Junio C HamanoJan 31, 2025
  7. Patrick SteinhardtFeb 3, 2025
  8. Taylor BlauFeb 10, 2025

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.