Skip to content

Commit 7b8ea19

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 7e5d2ec commit 7b8ea19

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
int i = 0;
2020
struct child_process child = CHILD_PROCESS_INIT;
@@ -43,9 +43,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
4343

4444
child.git_cmd = 1;
4545
strvec_pushl(&child.args, "-C", abspath, NULL);
46-
47-
for (i = 0; i < argc; i++)
48-
strvec_push(&child.args, argv[i]);
46+
strvec_pushv(&child.args, argv);
4947

5048
free(abspath);
5149

@@ -85,7 +83,7 @@ int cmd_for_each_repo(int argc,
8583
return 0;
8684

8785
for (size_t i = 0; i < values->nr; i++) {
88-
int ret = run_command_on_repo(values->items[i].string, argc, argv);
86+
int ret = run_command_on_repo(values->items[i].string, argv);
8987
if (ret) {
9088
if (!keep_going)
9189
return ret;

0 commit comments

Comments
 (0)