Re: [PATCH v4 10/11] receive-pack: convert update hooks to new API
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 16, 2025, 08:08 UTC
- Message-ID
- <aUETkJZe_qCS6ZV0@pks.im>
- In-Reply-To
- <20251204141535.1986263-11-adrian.ratiu@collabora.com>
On Thu, Dec 04, 2025 at 04:15:34PM +0200, Adrian Ratiu wrote:
Show 19 quoted lines
> 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