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 /diff.c | |
parent | 159c88e5ae95c5b02298193c1658fac5919c8012 (diff) | |
download | git-6d0e674a575421347abe5749e645ca6dc78c8207.tar.gz |
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 'diff.c')
-rw-r--r-- | diff.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1469,6 +1469,7 @@ static void builtin_diff(const char *name_a, ecbdata.file = o->file; xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts; xecfg.ctxlen = o->context; + xecfg.interhunkctxlen = o->interhunkcontext; xecfg.flags = XDL_EMIT_FUNCNAMES; if (pe) xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags); @@ -2538,6 +2539,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) options->b_prefix = arg + 13; else if (!strcmp(arg, "--no-prefix")) options->a_prefix = options->b_prefix = ""; + else if (opt_arg(arg, '\0', "inter-hunk-context", + &options->interhunkcontext)) + ; else if (!prefixcmp(arg, "--output=")) { options->file = fopen(arg + strlen("--output="), "w"); options->close_file = 1; |