Skip to content

Commit 8b1f083

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 e759b35 commit 8b1f083

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

builtin/for-each-repo.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@ 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
{
19-
int i;
2019
struct child_process child = CHILD_PROCESS_INIT;
2120
char *abspath = interpolate_path(path, 0);
2221

2322
sanitize_repo_env(&child.env);
2423

2524
child.git_cmd = 1;
2625
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);
3027

3128
free(abspath);
3229

@@ -66,7 +63,7 @@ int cmd_for_each_repo(int argc,
6663
return 0;
6764

6865
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);
7067
if (ret) {
7168
if (!keep_going)
7269
return ret;

0 commit comments

Comments
 (0)