From: brian m. carlson Date: Tue, 07 Jul 2026 21:25:48 GMT Subject: Re: [PATCH 1/7] hash: use git_hash_init() consistently Message-ID: In-Reply-To: <20260707050141.GA1288294@coredump.intra.peff.net> On 2026-07-07 at 05:01:41, Jeff King wrote: > We'd like to add more logic to git_hash_init(), but many callers skip it > and call algop->init_fn() directly. Let's make sure we're consistently > using the wrapper by adding a coccinelle rule. > > Besides the coccinelle file itself, this is a purely mechanical > conversion based on the patch it generates. There should be no bare > init_fn() calls left (except for the one in the wrapper). For context, the reason `git_hash_init` exists is that our Rust code needs to initialize a hash context but it treats `const struct git_hash_algo *` as `const void *` and doesn't have any access to the contents of the structure. We could fix this with `cbindgen` and `bindgen`, but haven't done so yet. So that's why everybody has been using `init_fn` instead of `git_hash_init`. Anyway, I have no objections to making this the standard interface going forward. -- brian m. carlson (they/them) Toronto, Ontario, CA