diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-01-29 23:47:53 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-29 23:47:54 +0300 |
commit | 773e4088819cb17150afd4929f32bccabb8e2acd (patch) | |
tree | 16a345c12e869466049d0c6641b783c32ed84c83 /diff.c | |
parent | 15b07cba0b60f0fc5dea0be0d68a355a8161476d (diff) | |
parent | 0da0e9268b4825cafb27bb0e07b43fae30bb33da (diff) |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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, |