Re: [PATCH v2 2/8] csum-file: store the hash algorithm as a struct field
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 16, 2025, 11:48 UTC
- Message-ID
- <Z4jyH4yIXuD0vuqQ@pks.im>
- In-Reply-To
- <99cc44895b57cc75fc8f447000817b3595368e4c.1736363652.git.me@ttaylorr.com>
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