From 9151f052eb3bee5cf42431ad9f1b533818d4baa4 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Fri, 17 Oct 2025 17:15:40 +0300 Subject: hook: allow overriding the ungroup option When calling run_process_parallel() in run_hooks_opt(), the ungroup option is currently hardcoded to .ungroup = 1. This causes problems when ungrouping should be disabled, for example when sideband-reading collated output from child hooks, because sideband-reading and ungrouping are mutually exclusive. Thus a new hook.h option is added to allow overriding. The existing ungroup=1 behavior is preserved in the run_hooks() API and the "hook run" command. We could modify these to take an option if necessary, so I added two code comments there. Signed-off-by: Adrian Ratiu Signed-off-by: Junio C Hamano --- commit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'commit.c') diff --git a/commit.c b/commit.c index 16d91b2bfc..7da33dde86 100644 --- a/commit.c +++ b/commit.c @@ -1965,6 +1965,9 @@ int run_commit_hook(int editor_is_used, const char *index_file, strvec_push(&opt.args, arg); va_end(args); + /* All commit hook use-cases require ungrouping child output. */ + opt.ungroup = 1; + opt.invoked_hook = invoked_hook; return run_hooks_opt(the_repository, name, &opt); } -- cgit v1.2.3