]> git.ipfire.org Git - thirdparty/git.git/commitdiff
run-command API: move *_tr2() users to "run_processes_parallel()"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 12 Oct 2022 21:02:27 +0000 (23:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Oct 2022 21:12:41 +0000 (14:12 -0700)
Have the users of the "run_processes_parallel_tr2()" function use
"run_processes_parallel()" instead. In preceding commits the latter
was refactored to take a "struct run_process_parallel_opts" argument,
since the only reason for "run_processes_parallel_tr2()" to exist was
to take arguments that are now a part of that struct we can do away
with it.

See ee4512ed481 (trace2: create new combined trace facility,
2019-02-22) for the addition of the "*_tr2()" variant of the function,
it was used by every caller except "t/helper/test-run-command.c"..

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
builtin/submodule--helper.c
run-command.c
run-command.h
submodule.c

index 82f1da14ec15150a8397a746bd1b5d9758386587..b06e454cbddaf1fb3cf8211acab71e90a526448b 100644 (file)
@@ -1953,15 +1953,21 @@ static int fetch_multiple(struct string_list *list, int max_children)
 
        if (max_children != 1 && list->nr != 1) {
                struct parallel_fetch_state state = { argv.v, list, 0, 0 };
+               const struct run_process_parallel_opts opts = {
+                       .tr2_category = "fetch",
+                       .tr2_label = "parallel/fetch",
+
+                       .processes = max_children,
+
+                       .get_next_task = &fetch_next_remote,
+                       .start_failure = &fetch_failed_to_start,
+                       .task_finished = &fetch_finished,
+                       .data = &state,
+               };
 
                strvec_push(&argv, "--end-of-options");
-               run_processes_parallel_tr2(max_children,
-                                          &fetch_next_remote,
-                                          &fetch_failed_to_start,
-                                          &fetch_finished,
-                                          &state,
-                                          "fetch", "parallel/fetch");
 
+               run_processes_parallel(&opts);
                result = state.result;
        } else
                for (i = 0; i < list->nr; i++) {
index 0b4acb442b209305949a2715ead54d9de518e10f..df526525c1eb82c6e692dc484b552f713601282f 100644 (file)
@@ -2567,12 +2567,20 @@ static int update_submodules(struct update_data *update_data)
 {
        int i, ret = 0;
        struct submodule_update_clone suc = SUBMODULE_UPDATE_CLONE_INIT;
+       const struct run_process_parallel_opts opts = {
+               .tr2_category = "submodule",
+               .tr2_label = "parallel/update",
+
+               .processes = update_data->max_jobs,
+
+               .get_next_task = update_clone_get_next_task,
+               .start_failure = update_clone_start_failure,
+               .task_finished = update_clone_task_finished,
+               .data = &suc,
+       };
 
        suc.update_data = update_data;
-       run_processes_parallel_tr2(suc.update_data->max_jobs, update_clone_get_next_task,
-                                  update_clone_start_failure,
-                                  update_clone_task_finished, &suc, "submodule",
-                                  "parallel/update");
+       run_processes_parallel(&opts);
 
        /*
         * We saved the output and put it out all at once now.
index 2858ec7bef5be2d8f66998946f46f8a461e33145..646ea22e39927073c303053b5212be03297501cc 100644 (file)
@@ -1827,24 +1827,6 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
                trace2_region_leave(tr2_category, tr2_label, NULL);
 }
 
-void run_processes_parallel_tr2(size_t processes, get_next_task_fn get_next_task,
-                               start_failure_fn start_failure,
-                               task_finished_fn task_finished, void *pp_cb,
-                               const char *tr2_category, const char *tr2_label)
-{
-       const struct run_process_parallel_opts opts = {
-               .tr2_category = tr2_category,
-               .tr2_label = tr2_label,
-               .processes = processes,
-
-               .get_next_task = get_next_task,
-               .start_failure = start_failure,
-               .task_finished = task_finished,
-       };
-
-       run_processes_parallel(&opts);
-}
-
 int run_auto_maintenance(int quiet)
 {
        int enabled;
index aabdaf684db5942ce3726370cb058f6dd2d18843..e3e1ea01ad9dde63eaa87d0f102955c36000d2f0 100644 (file)
@@ -528,9 +528,6 @@ struct run_process_parallel_opts
  * conditions due to writing in parallel to stdout and stderr.
  */
 void run_processes_parallel(const struct run_process_parallel_opts *opts);
-void run_processes_parallel_tr2(size_t processes, get_next_task_fn,
-                               start_failure_fn, task_finished_fn, void *pp_cb,
-                               const char *tr2_category, const char *tr2_label);
 
 /**
  * Convenience function which prepares env for a command to be run in a
index bf7a2c79183e17eb3b6c4c8487938de6c01be565..f7c71f1f4b12504dc3082fc6d10210337cf02791 100644 (file)
@@ -1819,6 +1819,17 @@ int fetch_submodules(struct repository *r,
 {
        int i;
        struct submodule_parallel_fetch spf = SPF_INIT;
+       const struct run_process_parallel_opts opts = {
+               .tr2_category = "submodule",
+               .tr2_label = "parallel/fetch",
+
+               .processes = max_parallel_jobs,
+
+               .get_next_task = get_next_submodule,
+               .start_failure = fetch_start_failure,
+               .task_finished = fetch_finish,
+               .data = &spf,
+       };
 
        spf.r = r;
        spf.command_line_option = command_line_option;
@@ -1840,12 +1851,7 @@ int fetch_submodules(struct repository *r,
 
        calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
        string_list_sort(&spf.changed_submodule_names);
-       run_processes_parallel_tr2(max_parallel_jobs,
-                                  get_next_submodule,
-                                  fetch_start_failure,
-                                  fetch_finish,
-                                  &spf,
-                                  "submodule", "parallel/fetch");
+       run_processes_parallel(&opts);
 
        if (spf.submodules_with_errors.len > 0)
                fprintf(stderr, _("Errors during submodule fetch:\n%s"),