Re* [PATCH v10 4/4] hook: introduce the receive-report hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 14, 2026, 22:36 UTC
- Message-ID
- <xmqqwlsn31gq.fsf_-_@gitster.g>
- In-Reply-To
- <CAOLa=ZS0PT4bb+k3HR4F_aOoJ5uUuMFx+Dnte4LpPEekFxs9uA@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
> I could send in this patch for coccinelle with the fixup if that's okay > with you.
This patch until it gets fixed will take the coccinelle updates hostage, so let's queue the following on top before merging it down to 'next'.
----- >8 ----- Subject: [PATCH] receive-pack: coccinelle fix
Let's not check the nullness of cmd->error_string_owned before calling FREE_AND_NULL(cmd->error_string_owned). It is cheap and safe to call FREE_AND_NULL(variable) for a variable that has NULL in it.
Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin/receive-pack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 9ac7717096..1d5b050beb 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2452,8 +2452,7 @@ static void update_shallow_info(struct command *commands, static void override_cmds_error(struct command *commands, const char *err) { for (struct command *cmd = commands; cmd; cmd = cmd->next) { - if (cmd->error_string_owned) - FREE_AND_NULL(cmd->error_string_owned); + FREE_AND_NULL(cmd->error_string_owned); cmd->error_string = err; } }
-- 2.56.0-rc0-195-g1e3108ffbb