From ddbb47fde9b6d8cd9f3728847a378f634318cfb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 30 Oct 2022 12:55:06 +0100 Subject: replace and remove run_command_v_opt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: René Scharfe Signed-off-by: Taylor Blau --- bisect.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bisect.c') diff --git a/bisect.c b/bisect.c index 090aa5c4b4..ec7487e683 100644 --- a/bisect.c +++ b/bisect.c @@ -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 -- cgit v1.2.3