]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: simplify building argument list in do_exec()
authorRené Scharfe <l.s.r@web.de>
Sun, 30 Oct 2022 11:49:37 +0000 (12:49 +0100)
committerTaylor Blau <me@ttaylorr.com>
Sun, 30 Oct 2022 18:04:37 +0000 (14:04 -0400)
Build child_argv during initialization, taking advantage of the C99
support for initialization expressions that are not compile time
constants.  This avoids the use of a magic index constant and is shorter
and simpler.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
sequencer.c

index debb2ecbafe2efdff334042b00c85badf7b88dfe..66eedd2c76434b8579ec3bc02d8e641df5f46f23 100644 (file)
@@ -3558,11 +3558,10 @@ static int error_failed_squash(struct repository *r,
 
 static int do_exec(struct repository *r, const char *command_line)
 {
-       const char *child_argv[] = { NULL, NULL };
+       const char *child_argv[] = { command_line, NULL };
        int dirty, status;
 
        fprintf(stderr, _("Executing: %s\n"), command_line);
-       child_argv[0] = command_line;
        status = run_command_v_opt(child_argv, RUN_USING_SHELL);
 
        /* force re-reading of the cache */