From a3d1f391d35762162356201028fb73774a6c4a8b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 15 Jan 2026 11:12:53 -0800 Subject: Revert "Merge branch 'ar/run-command-hook'" This reverts commit f406b8955295d01089ba2baf35eceadff2d11cae, reversing changes made to 1627809eeff75e6ec936fc609e7be46d5eb2fa9e. It seems to have caused a few regressions, two of the three known ones we have proposed solutions for. Let's give ourselves a bit more room to maneuver during the pre-release freeze period and restart once the 2.53 ships. --- hook.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'hook.c') diff --git a/hook.c b/hook.c index 35211e5ed7..b3de1048bf 100644 --- a/hook.c +++ b/hook.c @@ -55,7 +55,7 @@ int hook_exists(struct repository *r, const char *name) static int pick_next_hook(struct child_process *cp, struct strbuf *out UNUSED, void *pp_cb, - void **pp_task_cb) + void **pp_task_cb UNUSED) { struct hook_cb_data *hook_cb = pp_cb; const char *hook_path = hook_cb->hook_path; @@ -65,22 +65,11 @@ static int pick_next_hook(struct child_process *cp, cp->no_stdin = 1; strvec_pushv(&cp->env, hook_cb->options->env.v); - - if (hook_cb->options->path_to_stdin && hook_cb->options->feed_pipe) - BUG("options path_to_stdin and feed_pipe are mutually exclusive"); - /* reopen the file for stdin; run_command closes it. */ if (hook_cb->options->path_to_stdin) { cp->no_stdin = 0; cp->in = xopen(hook_cb->options->path_to_stdin, O_RDONLY); } - - if (hook_cb->options->feed_pipe) { - cp->no_stdin = 0; - /* start_command() will allocate a pipe / stdin fd for us */ - cp->in = -1; - } - cp->stdout_to_stderr = 1; cp->trace2_hook_name = hook_cb->hook_name; cp->dir = hook_cb->options->dir; @@ -88,12 +77,6 @@ static int pick_next_hook(struct child_process *cp, strvec_push(&cp->args, hook_path); strvec_pushv(&cp->args, hook_cb->options->args.v); - /* - * Provide per-hook internal state via task_cb for easy access, so - * hook callbacks don't have to go through hook_cb->options. - */ - *pp_task_cb = hook_cb->options->feed_pipe_cb_data; - /* * This pick_next_hook() will be called again, we're only * running one hook, so indicate that no more work will be @@ -153,12 +136,10 @@ int run_hooks_opt(struct repository *r, const char *hook_name, .tr2_label = hook_name, .processes = 1, - .ungroup = options->ungroup, + .ungroup = 1, .get_next_task = pick_next_hook, .start_failure = notify_start_failure, - .feed_pipe = options->feed_pipe, - .consume_output = options->consume_output, .task_finished = notify_hook_finished, .data = &cb_data, @@ -167,9 +148,6 @@ int run_hooks_opt(struct repository *r, const char *hook_name, if (!options) BUG("a struct run_hooks_opt must be provided to run_hooks"); - if (options->path_to_stdin && options->feed_pipe) - BUG("options path_to_stdin and feed_pipe are mutually exclusive"); - if (options->invoked_hook) *options->invoked_hook = 0; @@ -199,9 +177,6 @@ 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); } -- cgit v1.3