run-command tests: use strvec_pushv(), not argv assignment

As in the preceding commit change this API user to use strvec_pushv()
instead of assigning to the "argv" member directly. This leaves us
without test coverage of how the "argv" assignment in this API works,
but we'll be removing it in a subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-11-25 23:52:19 +01:00 коммит произвёл Junio C Hamano
Родитель 6def0ff878
Коммит 87ee87dd6b
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -31,7 +31,7 @@ static int parallel_next(struct child_process *cp,
if (number_callbacks >= 4) if (number_callbacks >= 4)
return 0; return 0;
strvec_pushv(&cp->args, d->argv); strvec_pushv(&cp->args, d->args.v);
strbuf_addstr(err, "preloaded output of a child\n"); strbuf_addstr(err, "preloaded output of a child\n");
number_callbacks++; number_callbacks++;
return 1; return 1;
@ -274,7 +274,7 @@ static int quote_stress_test(int argc, const char **argv)
if (i < skip) if (i < skip)
continue; continue;
cp.argv = args.v; strvec_pushv(&cp.args, args.v);
strbuf_reset(&out); strbuf_reset(&out);
if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0) < 0) if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0) < 0)
return error("Failed to spawn child process"); return error("Failed to spawn child process");
@ -396,7 +396,7 @@ int cmd__run_command(int argc, const char **argv)
} }
if (argc < 3) if (argc < 3)
return 1; return 1;
proc.argv = (const char **)argv + 2; strvec_pushv(&proc.args, (const char **)argv + 2);
if (!strcmp(argv[1], "start-command-ENOENT")) { if (!strcmp(argv[1], "start-command-ENOENT")) {
if (start_command(&proc) < 0 && errno == ENOENT) if (start_command(&proc) < 0 && errno == ENOENT)
@ -408,7 +408,8 @@ int cmd__run_command(int argc, const char **argv)
exit(run_command(&proc)); exit(run_command(&proc));
jobs = atoi(argv[2]); jobs = atoi(argv[2]);
proc.argv = (const char **)argv + 3; strvec_clear(&proc.args);
strvec_pushv(&proc.args, (const char **)argv + 3);
if (!strcmp(argv[1], "run-command-parallel")) if (!strcmp(argv[1], "run-command-parallel"))
exit(run_processes_parallel(jobs, parallel_next, exit(run_processes_parallel(jobs, parallel_next,