diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-26 15:25:03 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-26 15:32:37 -0700 |
commit | afbdba391eaf3c473eff8f12437ff510935b520f (patch) | |
tree | 06acc6a781e2c598873943ee407513a60ef7a3db /trailer.c | |
parent | 47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc (diff) | |
download | git-afbdba391eaf3c473eff8f12437ff510935b520f.tar.gz |
run_command: teach API users to use embedded 'args' more
The child_process structure has an embedded strvec for formulating
the command line argument list these days, but code that predates
the wide use of it prepared a separate char *argv[] array and
manually set the child_process.argv pointer point at it.
Teach these old-style code to lose the separate argv[] array.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r-- | trailer.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -221,15 +221,13 @@ static char *apply_command(const char *command, const char *arg) struct strbuf cmd = STRBUF_INIT; struct strbuf buf = STRBUF_INIT; struct child_process cp = CHILD_PROCESS_INIT; - const char *argv[] = {NULL, NULL}; char *result; strbuf_addstr(&cmd, command); if (arg) strbuf_replace(&cmd, TRAILER_ARG_STRING, arg); - argv[0] = cmd.buf; - cp.argv = argv; + strvec_push(&cp.args, cmd.buf); cp.env = local_repo_env; cp.no_stdin = 1; cp.use_shell = 1; |