diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-06 12:49:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-06 12:49:24 -0700 |
| commit | df5c2c4962819e0baf9982e41905e0e3bc8ed9e8 (patch) | |
| tree | 729d7162f3f8bdb0f73c06b1c18b9dda52c1e0ab /builtin | |
| parent | Merge branch 'th/quiet-lazy-fetch-from-promisor' (diff) | |
| parent | difftool: add env vars directly in run_file_diff() (diff) | |
| download | git-df5c2c4962819e0baf9982e41905e0e3bc8ed9e8.tar.gz git-df5c2c4962819e0baf9982e41905e0e3bc8ed9e8.zip | |
Merge branch 'rs/difftool-env-simplify'
Code simplification.
* rs/difftool-env-simplify:
difftool: add env vars directly in run_file_diff()
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/difftool.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c index a130faae4f..a1794b7eed 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -674,19 +674,15 @@ finish: static int run_file_diff(int prompt, const char *prefix, struct child_process *child) { - const char *env[] = { - "GIT_PAGER=", "GIT_EXTERNAL_DIFF=git-difftool--helper", NULL, - NULL - }; - + strvec_push(&child->env, "GIT_PAGER="); + strvec_push(&child->env, "GIT_EXTERNAL_DIFF=git-difftool--helper"); if (prompt > 0) - env[2] = "GIT_DIFFTOOL_PROMPT=true"; + strvec_push(&child->env, "GIT_DIFFTOOL_PROMPT=true"); else if (!prompt) - env[2] = "GIT_DIFFTOOL_NO_PROMPT=true"; + strvec_push(&child->env, "GIT_DIFFTOOL_NO_PROMPT=true"); child->git_cmd = 1; child->dir = prefix; - strvec_pushv(&child->env, env); return run_command(child); } |
