aboutsummaryrefslogtreecommitdiffstats
path: root/hook.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-10-27 14:51:53 -0700
committerJunio C Hamano <gitster@pobox.com>2022-10-27 14:51:53 -0700
commit6ae1a6eaf2630365c8dd6f8764881b79ba6899ff (patch)
tree819dbc41fe53a4b9b5aaa7fa9bd56cd18ca4247a /hook.c
parentf62c546455cd5e9392b33147b72f0ffd66801636 (diff)
parent0b0ab95f17d5eb71d2552e2c3b0806e2ed87beca (diff)
downloadgit-6ae1a6eaf2630365c8dd6f8764881b79ba6899ff.tar.gz
Merge branch 'ab/run-hook-api-cleanup'
Move a global variable added as a hack during regression fixes to its proper place in the API. * ab/run-hook-api-cleanup: run-command.c: remove "max_processes", add "const" to signal() handler run-command.c: pass "opts" further down, and use "opts->processes" run-command.c: use "opts->processes", not "pp->max_processes" run-command.c: don't copy "data" to "struct parallel_processes" run-command.c: don't copy "ungroup" to "struct parallel_processes" run-command.c: don't copy *_fn to "struct parallel_processes" run-command.c: make "struct parallel_processes" const if possible run-command API: move *_tr2() users to "run_processes_parallel()" run-command API: have run_process_parallel() take an "opts" struct run-command.c: use designated init for pp_init(), add "const" run-command API: don't fall back on online_cpus() run-command API: make "n" parameter a "size_t" run-command tests: use "return", not "exit" run-command API: have "run_processes_parallel{,_tr2}()" return void run-command test helper: use "else if" pattern
Diffstat (limited to 'hook.c')
-rw-r--r--hook.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/hook.c b/hook.c
index a493939a4f..a4fa1031f2 100644
--- a/hook.c
+++ b/hook.c
@@ -114,8 +114,20 @@ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options)
.options = options,
};
const char *const hook_path = find_hook(hook_name);
- int jobs = 1;
int ret = 0;
+ const struct run_process_parallel_opts opts = {
+ .tr2_category = "hook",
+ .tr2_label = hook_name,
+
+ .processes = 1,
+ .ungroup = 1,
+
+ .get_next_task = pick_next_hook,
+ .start_failure = notify_start_failure,
+ .task_finished = notify_hook_finished,
+
+ .data = &cb_data,
+ };
if (!options)
BUG("a struct run_hooks_opt must be provided to run_hooks");
@@ -137,14 +149,7 @@ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options)
cb_data.hook_path = abs_path.buf;
}
- run_processes_parallel_ungroup = 1;
- run_processes_parallel_tr2(jobs,
- pick_next_hook,
- notify_start_failure,
- notify_hook_finished,
- &cb_data,
- "hook",
- hook_name);
+ run_processes_parallel(&opts);
ret = cb_data.rc;
cleanup:
strbuf_release(&abs_path);