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

Re: [PATCH v2 3/4] Integrate hash algorithm support with repo setup

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 30, 2017, 02:54 UTC
Message-ID
<20171030025405.53f4sqxlc53vqake@genre.crustytoothpaste.net>
In-Reply-To
<xmqq7evd8jsa.fsf@gitster.mtv.corp.google.com>
On Mon, Oct 30, 2017 at 11:13:41AM +0900, Junio C Hamano wrote:
Show 20 quoted lines
> Is the plan to allow running with multiple hash algorithms in
> parallel?  I thought what we want to see in the future codebase was
> to have the default hash algorithm used for everything except for a
> select few codepaths, and assumed that the way we achieve it is to
> 
>  - allow very low level helper functions (e.g. read_sha1_file(),
>    write_sha1_file_prepare(), etc.) to take a pointer to the hash
>    algorithm structure;
> 
>  - have higher level helper functions to call these low level
>    helpers with a fixed singleton instance of hash algorithm
>    structure that represents that default one (SHA2-something?); and
> 
>  - a few selected codepaths (e.g. index-pack that reads SHA-1 stream
>    and converts it into NewHash pack/index while building the object
>    name mapping) use an additional singleton instance of hash
>    algorithm structure that represents the SHA-1 hash, and the way
>    they use it is *NOT* by replacing "the current" one with SHA-1,
>    but by explicitly passing the instance to the low level helpers
>    as parameter.
This is consistent with my understanding as well.
Show 6 quoted lines
> So, "current" does indeed sound quite wrong, as it makes it sound as
> if you can swap it anytime and ask "which one is in effect now?".
> If we do not want to call the default instance "SHA-2" because we
> want to prepare for migrating again by not having the name of a
> concrete hash algorithm sprinkled in the codebase all over like we
> currently do, why not call the instance "the_hash_algo"?

My original plan was to handle different algorithms in different submodules, but I think with the current transition plan, that becomes unnecessary, since we're going to paper over any differences that might show up. the_hash_algo should be fine, and it's consistent with the_repository and the_index as well.

Thanks for a sensible suggestion.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Previous: Junio C HamanoNext: Stefan Beller
Message 10 of 19 in “Hash Abstraction”
  1. 0/4 Hash Abstractionbrian m. carlson, Oct 28, 2017
  2. 1/4 setup: expose enumerated repo infobrian m. carlson, Oct 28, 2017
  3. Stefan BellerOct 30, 2017
  4. 3/4 Integrate hash algorithm support with repo setupbrian m. carlson, Oct 28, 2017
  5. Eric SunshineOct 29, 2017
  6. brian m. carlsonOct 29, 2017
  7. Eric SunshineOct 29, 2017
  8. brian m. carlsonOct 29, 2017
  9. Junio C HamanoOct 30, 2017
  10. brian m. carlsonOct 30, 2017
  11. Stefan BellerOct 30, 2017
  12. 2/4 Add structure representing hash algorithmbrian m. carlson, Oct 28, 2017
  13. Eric SunshineOct 29, 2017
  14. brian m. carlsonOct 29, 2017
  15. Stefan BellerOct 30, 2017
  16. Brandon WilliamsOct 30, 2017
  17. brian m. carlsonNov 1, 2017
  18. 4/4 Switch empty tree and blob lookups to use hash abstractionbrian m. carlson, Oct 28, 2017
  19. Stefan BellerOct 30, 2017

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.