Re: [PATCH 1/7] hash: use git_hash_init() consistently
- From
Jeff King <peff@peff.net>
- Date
- Jul 7, 2026, 20:13 UTC
- Message-ID
- <20260707201315.GC11780@coredump.intra.peff.net>
- In-Reply-To
- <xmqq5x2q984j.fsf@gitster.g>
On Tue, Jul 07, 2026 at 07:39:24AM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> > diff --git a/object-file.c b/object-file.c
> > index e3c68cfb66..f292683c2d 100644
> > --- a/object-file.c
> > +++ b/object-file.c
> > ...
> > - algo->init_fn(c);
> > - if (compat && compat_c)
> > - compat->init_fn(compat_c);
> > + git_hash_init(c, algo);
> > + if (compat && compat_c) {
> > + git_hash_init(compat_c, compat);
> > + }
>
> For example, it is a mystery how Coccinelle decided to add a pair of
> braces around this single statement. It should be obvious that the
> corresponding single statement in the original did not need one.Yeah, I noticed that coccinelle was eager to add braces in a few cases, but I'm not sure why.
I had actually removed them, but either I missed these two, or more likely I ended up re-applying the semantic patch a final time before committing (I did a lot of "reset --hard; make hash.cocci.patch && git apply hash.cocci.patch" while testing various refactors of the patch itself).
I'll drop them in v2. Thanks for reading carefully.
-Peff