summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-10-19 13:14:20 +0200
committerJunio C Hamano <gitster@pobox.com>2014-10-19 15:26:34 -0700
commita915459097b72da9cc058172a54029352b684b0f (patch)
tree4e8ba96b870ec7df1227e6819b176f64ca8b0ef7 /wt-status.c
parent19a583dc39e3e1110f746e837c5ce1953d6ebfa1 (diff)
downloadgit-a915459097b72da9cc058172a54029352b684b0f.tar.gz
use env_array member of struct child_processrs/run-command-env-array
Convert users of struct child_process to using the managed env_array for specifying environment variables instead of supplying an array on the stack or bringing their own argv_array. This shortens and simplifies the code and ensures automatically that the allocated memory is freed after use. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c
index 1bf5d72545..66d267c674 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -726,14 +726,14 @@ 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 = CHILD_PROCESS_INIT;
- struct argv_array env = ARGV_ARRAY_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");
@@ -745,14 +745,12 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
argv_array_push(&argv, s->amend ? "HEAD^" : "HEAD");
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);