Subject: Re: [PATCH v4 10/11] receive-pack: convert update hooks to new API

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 16 Dec 2025 09:08:48 +0100

On Thu, Dec 04, 2025 at 04:15:34PM +0200, Adrian Ratiu wrote:
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index e8ee0e7321..d95df748cd 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -938,31 +938,26 @@ static int run_receive_hook(struct command *commands,
>  	return status;
>  }
>  
> -static int run_update_hook(struct command *cmd)
> +static void hook_output_to_sideband(struct strbuf *output, void *cb_data UNUSED)
>  {
> -	struct child_process proc = CHILD_PROCESS_INIT;
> -	int code;
> -	const char *hook_path = find_hook(the_repository, "update");
> -
> -	if (!hook_path)
> -		return 0;
> +	if (output && output->len)
> +		send_sideband(1, 2, output->buf, output->len, use_sideband);

Nit, not worth a reroll: the buffer shouldn't ever be `NULL`, should it?
Checking for `output->len` does make sense though, as we may receive
empty buffers for keepalives.

Patrick