]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack: convert update hooks to new API
authorEmily Shaffer <emilyshaffer@google.com>
Wed, 28 Jan 2026 21:39:26 +0000 (23:39 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2026 23:47:04 +0000 (15:47 -0800)
commitfc148b146ad41be71a7852c4867f0773cbfe1ff9
treebe75b17ef40477fca552afd561cebafc424e9427
parentc45a34e12e8699f656ec3613b6ba158c1a57c5e8
receive-pack: convert update hooks to new API

The hook API avoids creating a custom struct child_process and other
internal hook plumbing (e.g. calling find_hook()) and prepares for
the specification of hooks via configs or running parallel hooks.

Execution is still sequential through the run_hooks_opt .jobs == 1,
which is the unchanged default for all hooks.

When use_sideband==1, the async thread redirects the hook outputs to
sideband 2, otherwise it is not used and the hooks write directly to
the fds inherited from the main parent process.

When .jobs == 1, run-command's poll loop is avoided entirely via the
ungroup=1 option like before (this was Jeff's suggestion), achieving
the same real-time output performance.

When running in parallel, run-command with ungroup=0 will capture
and de-interleave the output of each hook, then write to the parent
stderr which is redirected via dup2 to the sideband thread, so that
each parallel hook output is presented clearly to the client.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c