Skip to content

Commit f6582e9

Browse files
committed
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>
1 parent 2a60910 commit f6582e9

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

builtin/for-each-repo.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static const char * const for_each_repo_usage[] = {
1414
NULL
1515
};
1616

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)
1818
{
1919
struct child_process child = CHILD_PROCESS_INIT;
2020
char *abspath = interpolate_path(path, 0);
@@ -23,9 +23,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
2323

2424
child.git_cmd = 1;
2525
strvec_pushl(&child.args, "-C", abspath, NULL);
26-
27-
for (i = 0; i < argc; i++)
28-
strvec_push(&child.args, argv[i]);
26+
strvec_pushv(&child.args, argv);
2927

3028
free(abspath);
3129

@@ -65,7 +63,7 @@ int cmd_for_each_repo(int argc,
6563
return 0;
6664

6765
for (size_t i = 0; i < values->nr; i++) {
68-
int ret = run_command_on_repo(values->items[i].string, argc, argv);
66+
int ret = run_command_on_repo(values->items[i].string, argv);
6967
if (ret) {
7068
if (!keep_going)
7169
return ret;

0 commit comments

Comments
 (0)