Skip to content

Commit 7b7db54

Browse files
committed
Merge branch 'rs/difftool-env-simplify' into maint-2.45
Code simplification. * rs/difftool-env-simplify: difftool: add env vars directly in run_file_diff()
2 parents 6e3eb34 + 36d900d commit 7b7db54

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

builtin/difftool.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -674,19 +674,15 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
674674
static int run_file_diff(int prompt, const char *prefix,
675675
struct child_process *child)
676676
{
677-
const char *env[] = {
678-
"GIT_PAGER=", "GIT_EXTERNAL_DIFF=git-difftool--helper", NULL,
679-
NULL
680-
};
681-
677+
strvec_push(&child->env, "GIT_PAGER=");
678+
strvec_push(&child->env, "GIT_EXTERNAL_DIFF=git-difftool--helper");
682679
if (prompt > 0)
683-
env[2] = "GIT_DIFFTOOL_PROMPT=true";
680+
strvec_push(&child->env, "GIT_DIFFTOOL_PROMPT=true");
684681
else if (!prompt)
685-
env[2] = "GIT_DIFFTOOL_NO_PROMPT=true";
682+
strvec_push(&child->env, "GIT_DIFFTOOL_NO_PROMPT=true");
686683

687684
child->git_cmd = 1;
688685
child->dir = prefix;
689-
strvec_pushv(&child->env, env);
690686

691687
return run_command(child);
692688
}

0 commit comments

Comments
 (0)