diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2008-12-28 19:45:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-29 01:05:21 -0800 |
commit | 6d0e674a575421347abe5749e645ca6dc78c8207 (patch) | |
tree | 520bca6d03fe6bf525d218ea4d28805285f1e070 /xdiff/xemit.c | |
parent | Merge branch 'maint' (diff) | |
download | tgif-6d0e674a575421347abe5749e645ca6dc78c8207.tar.xz |
diff: add option to show context between close hunks
Merge two hunks if there is only the specified number of otherwise unshown
context between them. For --inter-hunk-context=1, the resulting patch has
the same number of lines but shows uninterrupted context instead of a
context header line in between.
Patches generated with this option are easier to read but are also more
likely to conflict if the file to be patched contains other changes.
This patch keeps the default for this option at 0. It is intended to just
make the feature available in order to see its advantages and downsides.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xemit.c')
-rw-r--r-- | xdiff/xemit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xdiff/xemit.c b/xdiff/xemit.c index 4625c1b421..05bfa41f10 100644 --- a/xdiff/xemit.c +++ b/xdiff/xemit.c @@ -59,9 +59,10 @@ static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t * */ xdchange_t *xdl_get_hunk(xdchange_t *xscr, xdemitconf_t const *xecfg) { xdchange_t *xch, *xchp; + long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen; for (xchp = xscr, xch = xscr->next; xch; xchp = xch, xch = xch->next) - if (xch->i1 - (xchp->i1 + xchp->chg1) > 2 * xecfg->ctxlen) + if (xch->i1 - (xchp->i1 + xchp->chg1) > max_common) break; return xchp; |