Re: [PATCH v2 2/8] csum-file: store the hash algorithm as a struct field
From: Patrick Steinhardt <hidden>
Date: 2025-01-16 11:49:03
From: Patrick Steinhardt <hidden>
Date: 2025-01-16 11:49:03
On Wed, Jan 08, 2025 at 02:14:35PM -0500, Taylor Blau wrote:
Throughout the hashfile API, we rely on a reference to 'the_hash_algo', and call its _usnafe function variants directly.
s/usnafe/unsafe/
Prepare for a future change where we may use a different 'git_hash_algo' pointer (instead of just relying on 'the_hash_algo' throughout) by making the 'git_hash_algo' pointer a member of the 'hashfile' structure itself.
Makes sense, and it's also a good step for libification. I wonder: does it mean that we can also get rid of `USE_THE_REPOSITORY_VARIABLE`, or do we still depend on it in this file? The answer is yes, as we only reduce the sites where we use `the_hash_algo`, but don't remove it altogether. That would require the caller to provide the hash algo to us. Patrick