From: Junio C Hamano Date: Wed, 21 Sep 2016 22:15:26 +0000 (-0700) Subject: Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' X-Git-Tag: v2.11.0-rc0~126 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4ed38637ec6fa08b4bef42a35d87f95c0582b97b?ds=inline;hp=-c Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' "git diff -W" output needs to extend the context backward to include the header line of the current function and also forward to include the body of the entire current function up to the header line of the next one. This process may have to merge to adjacent hunks, but the code forgot to do so in some cases. * rs/xdiff-merge-overlapping-hunks-for-W-context: xdiff: fix merging of hunks with -W context and -u context --- 4ed38637ec6fa08b4bef42a35d87f95c0582b97b diff --combined xdiff/xemit.c index b52b4b9c1e,5079029174..7389ce4102 --- a/xdiff/xemit.c +++ b/xdiff/xemit.c @@@ -22,6 -22,15 +22,6 @@@ #include "xinclude.h" - - - -static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec); -static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t *ecb); - - - - static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec) { *rec = xdf->recs[ri]->ptr; @@@ -239,7 -248,7 +239,7 @@@ int xdl_emit_diff(xdfenv_t *xe, xdchang if (xche->next) { long l = XDL_MIN(xche->next->i1, xe->xdf1.nrec - 1); - if (l <= e1 || + if (l - xecfg->ctxlen <= e1 || get_func_line(xe, xecfg, NULL, l, e1) < 0) { xche = xche->next; goto post_context_calculation;