aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--builtin/hook.c6
-rw-r--r--commit.c3
-rw-r--r--hook.c5
-rw-r--r--hook.h5
4 files changed, 18 insertions, 1 deletions
diff --git a/builtin/hook.c b/builtin/hook.c
index 7afec380d2..73e7b8c2e8 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -44,6 +44,12 @@ static int run(int argc, const char **argv, const char *prefix,
goto usage;
/*
+ * All current "hook run" use-cases require ungrouped child output.
+ * If this changes, a hook run argument can be added to toggle it.
+ */
+ opt.ungroup = 1;
+
+ /*
* Having a -- for "run" when providing <hook-args> is
* mandatory.
*/
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);
}
diff --git a/hook.c b/hook.c
index 7537cf0f9e..a325c7cb8c 100644
--- a/hook.c
+++ b/hook.c
@@ -147,7 +147,7 @@ int run_hooks_opt(struct repository *r, const char *hook_name,
.tr2_label = hook_name,
.processes = 1,
- .ungroup = 1,
+ .ungroup = options->ungroup,
.get_next_task = pick_next_hook,
.start_failure = notify_start_failure,
@@ -192,6 +192,9 @@ int run_hooks(struct repository *r, const char *hook_name)
{
struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
+ /* All use-cases of this API require ungrouping. */
+ opt.ungroup = 1;
+
return run_hooks_opt(r, hook_name, &opt);
}
diff --git a/hook.h b/hook.h
index ebe5dc450e..82b3d1dd27 100644
--- a/hook.h
+++ b/hook.h
@@ -35,6 +35,11 @@ struct run_hooks_opt
int *invoked_hook;
/**
+ * Allow hooks to set run_processes_parallel() 'ungroup' behavior.
+ */
+ unsigned int ungroup:1;
+
+ /**
* Path to file which should be piped to stdin for each hook.
*/
const char *path_to_stdin;