for-each-repo: simplify passing of parameters
This change simplifies the code somewhat from its original implementation. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Mar 3, 2026 at 17:31 UTC
e87493b9b4876e8278062af70cf2d97f47c45e60
1 file changed
+3
-6
builtin/for-each-repo.c
+3
-6
@@ -14,9 +14,8 @@ static const char * const for_each_repo_usage[] = {
14
NULL
15
};
16
17
-static int run_command_on_repo(const char *path, int argc, const char ** argv)
17
+static int run_command_on_repo(const char *path, const char **argv)
18
{
19
- int i;
19
struct child_process child = CHILD_PROCESS_INIT;
20
char *abspath = interpolate_path(path, 0);
21
@@ -24,9 +23,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
23
24
child.git_cmd = 1;
25
strvec_pushl(&child.args, "-C", abspath, NULL);
27
-
28
- for (i = 0; i < argc; i++)
29
- strvec_push(&child.args, argv[i]);
26
+ strvec_pushv(&child.args, argv);
27
28
free(abspath);
29
@@ -66,7 +63,7 @@ int cmd_for_each_repo(int argc,
63
return 0;
64
65
for (size_t i = 0; i < values->nr; i++) {
69
- int ret = run_command_on_repo(values->items[i].string, argc, argv);
66
+ int ret = run_command_on_repo(values->items[i].string, argv);
67
if (ret) {
68
if (!keep_going)
69
return ret;