summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:54 (GMT)
commit773e4088819cb17150afd4929f32bccabb8e2acd (patch)
tree16a345c12e869466049d0c6641b783c32ed84c83 /diff.c
parent15b07cba0b60f0fc5dea0be0d68a355a8161476d (diff)
parent0da0e9268b4825cafb27bb0e07b43fae30bb33da (diff)
downloadgit-773e4088819cb17150afd4929f32bccabb8e2acd.zip
git-773e4088819cb17150afd4929f32bccabb8e2acd.tar.gz
git-773e4088819cb17150afd4929f32bccabb8e2acd.tar.bz2
Merge branch 'jk/save-getenv-result'
There were many places the code relied on the string returned from getenv() to be non-volatile, which is not true, that have been corrected. * jk/save-getenv-result: builtin_diff(): read $GIT_DIFF_OPTS closer to use merge-recursive: copy $GITHEAD strings init: make a copy of $GIT_DIR string config: make a copy of $GIT_CONFIG string commit: copy saved getenv() result get_super_prefix(): copy getenv() result
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 084bf54..e8c3e80 100644
--- a/diff.c
+++ b/diff.c
@@ -3544,7 +3544,7 @@ static void builtin_diff(const char *name_a,
o->found_changes = 1;
} else {
/* Crazy xdl interfaces.. */
- const char *diffopts = getenv("GIT_DIFF_OPTS");
+ const char *diffopts;
const char *v;
xpparam_t xpp;
xdemitconf_t xecfg;
@@ -3587,12 +3587,15 @@ static void builtin_diff(const char *name_a,
xecfg.flags |= XDL_EMIT_FUNCCONTEXT;
if (pe)
xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);
+
+ diffopts = getenv("GIT_DIFF_OPTS");
if (!diffopts)
;
else if (skip_prefix(diffopts, "--unified=", &v))
xecfg.ctxlen = strtoul(v, NULL, 10);
else if (skip_prefix(diffopts, "-u", &v))
xecfg.ctxlen = strtoul(v, NULL, 10);
+
if (o->word_diff)
init_diff_words_data(&ecbdata, o, one, two);
if (xdi_diff_outf(&mf1, &mf2, NULL, fn_out_consume,