replace and remove run_command_v_opt()

Replace the remaining calls of run_command_v_opt() with run_command()
calls and explict struct child_process variables.  This is more verbose,
but not by much overall.  The code becomes more flexible, e.g. it's easy
to extend to conditionally add a new argument.

Then remove the now unused function and its own flag names, simplifying
the run-command API.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
René Scharfe
2022-10-30 12:55:06 +01:00
committed by Taylor Blau
parent ef249b398e
commit ddbb47fde9
13 changed files with 92 additions and 75 deletions

View File

@ -737,11 +737,12 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
} else {
const char *argv_checkout[] = {
"checkout", "-q", oid_to_hex(bisect_rev), "--", NULL
};
struct child_process cmd = CHILD_PROCESS_INIT;
if (run_command_v_opt(argv_checkout, RUN_GIT_CMD))
cmd.git_cmd = 1;
strvec_pushl(&cmd.args, "checkout", "-q",
oid_to_hex(bisect_rev), "--", NULL);
if (run_command(&cmd))
/*
* Errors in `run_command()` itself, signaled by res < 0,
* and errors in the child process, signaled by res > 0