t9001: style modernisation phase #5
[gitweb.git] / wt-status.c
index 27da5296be253844e0f2bc8d5996faf343192828..cdbc8d798aaff6fff833224ff94b83af49289a5a 100644 (file)
@@ -128,7 +128,7 @@ void wt_status_prepare(struct wt_status *s)
        s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
        s->use_color = -1;
        s->relative_paths = 1;
-       s->branch = resolve_refdup("HEAD", sha1, 0, NULL);
+       s->branch = resolve_refdup("HEAD", 0, sha1, NULL);
        s->reference = "HEAD";
        s->fp = stdout;
        s->index_file = get_index_file();
@@ -725,15 +725,15 @@ static void wt_status_print_changed(struct wt_status *s)
 
 static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitted)
 {
-       struct child_process sm_summary;
-       struct argv_array env = ARGV_ARRAY_INIT;
+       struct child_process sm_summary = CHILD_PROCESS_INIT;
        struct argv_array argv = ARGV_ARRAY_INIT;
        struct strbuf cmd_stdout = STRBUF_INIT;
        struct strbuf summary = STRBUF_INIT;
        char *summary_content;
        size_t len;
 
-       argv_array_pushf(&env, "GIT_INDEX_FILE=%s", s->index_file);
+       argv_array_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s",
+                        s->index_file);
 
        argv_array_push(&argv, "submodule");
        argv_array_push(&argv, "summary");
@@ -744,16 +744,13 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
        if (!uncommitted)
                argv_array_push(&argv, s->amend ? "HEAD^" : "HEAD");
 
-       memset(&sm_summary, 0, sizeof(sm_summary));
        sm_summary.argv = argv.argv;
-       sm_summary.env = env.argv;
        sm_summary.git_cmd = 1;
        sm_summary.no_stdin = 1;
        fflush(s->fp);
        sm_summary.out = -1;
 
        run_command(&sm_summary);
-       argv_array_clear(&env);
        argv_array_clear(&argv);
 
        len = strbuf_read(&cmd_stdout, sm_summary.out, 1024);