submodule.c: use argv_array in is_submodule_modified
authorStefan Beller <sbeller@google.com>
Sat, 25 Mar 2017 00:36:04 +0000 (17:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Mar 2017 16:48:18 +0000 (09:48 -0700)
struct argv_array is easier to use and maintain.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
submodule.c
index 3200b7bb2b2360c7efab86b680ed5d0cafa5e9d3..2c667ac95a14fd7dc801f8ef0c6658843d744cd5 100644 (file)
@@ -1043,12 +1043,6 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
 {
        ssize_t len;
        struct child_process cp = CHILD_PROCESS_INIT;
-       const char *argv[] = {
-               "status",
-               "--porcelain",
-               NULL,
-               NULL,
-       };
        struct strbuf buf = STRBUF_INIT;
        unsigned dirty_submodule = 0;
        const char *line, *next_line;
@@ -1066,10 +1060,10 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
        }
        strbuf_reset(&buf);
 
+       argv_array_pushl(&cp.args, "status", "--porcelain", NULL);
        if (ignore_untracked)
-               argv[2] = "-uno";
+               argv_array_push(&cp.args, "-uno");
 
-       cp.argv = argv;
        prepare_submodule_repo_env(&cp.env_array);
        cp.git_cmd = 1;
        cp.no_stdin = 1;