]> git.ipfire.org Git - thirdparty/git.git/blobdiff - hook.c
run-command API: have run_process_parallel() take an "opts" struct
[thirdparty/git.git] / hook.c
diff --git a/hook.c b/hook.c
index a493939a4fc5901d85a9ad08ca10669641598389..a4fa1031f287652eb734b276d9d6c98df40d9a08 100644 (file)
--- 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);