Re: [PATCH v2 2/8] csum-file: store the hash algorithm as a struct field
From: Taylor Blau <hidden>
Date: 2025-01-17 21:17:22
On Thu, Jan 16, 2025 at 12:48:58PM +0100, Patrick Steinhardt wrote:
On Wed, Jan 08, 2025 at 02:14:35PM -0500, Taylor Blau wrote:quoted
Throughout the hashfile API, we rely on a reference to 'the_hash_algo', and call its _usnafe function variants directly.s/usnafe/unsafe/
Oops. Thanks for spotting!
quoted
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.
Yeah, I agree that we're not quite there yet, but likewise that this patch is a step in that direction. Thanks, Taylor