author | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 Oct 2011 17:49:13 +0000 (10:49 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 Oct 2011 17:49:13 +0000 (10:49 -0700) |
* rs/diff-whole-function:
diff: add option to show whole functions as context
xdiff: factor out get_func_line()
diff: add option to show whole functions as context
xdiff: factor out get_func_line()
1 | 2 | |||
---|---|---|---|---|
Documentation/diff-options.txt | patch | | diff1 | | diff2 | | blob | history |
diff.c | patch | | diff1 | | diff2 | | blob | history |
diff --combined Documentation/diff-options.txt
index 5c53bdba948ea817e01e169a9fc183d4fc2d1313,1ce4ae3b17a7bca7082e499bf7edbc80359c2e79..08b581f040859d39aeaad8294bc7a3e7760ab0b9
Synonym for `-p --raw`.
endif::git-format-patch[]
+--minimal::
+ Spend extra time to make sure the smallest possible
+ diff is produced.
+
--patience::
Generate a diff using the "patience diff" algorithm.
Show the context between diff hunks, up to the specified number
of lines, thereby fusing hunks that are close to each other.
+ -W::
+ --function-context::
+ Show whole surrounding functions of changes.
+
ifndef::git-format-patch[]
--exit-code::
Make the program exit with codes similar to diff(1).
diff --combined diff.c
index d922b77aef2da84824a8e14fc21961e36e6d2e36,42c4891eb3e7163786d51d01f7219b2421e09dd3..374ecf3b486e218c52f94ba14481a715c19b80db
+++ b/diff.c
xecfg.ctxlen = o->context;
xecfg.interhunkctxlen = o->interhunkcontext;
xecfg.flags = XDL_EMIT_FUNCNAMES;
+ if (DIFF_OPT_TST(o, FUNCCONTEXT))
+ xecfg.flags |= XDL_EMIT_FUNCCONTEXT;
if (pe)
xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);
if (!diffopts)
memset(&xpp, 0, sizeof(xpp));
memset(&xecfg, 0, sizeof(xecfg));
xpp.flags = o->xdl_opts;
+ xecfg.ctxlen = o->context;
+ xecfg.interhunkctxlen = o->interhunkcontext;
xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
&xpp, &xecfg);
}
}
/* xdiff options */
+ else if (!strcmp(arg, "--minimal"))
+ DIFF_XDL_SET(options, NEED_MINIMAL);
+ else if (!strcmp(arg, "--no-minimal"))
+ DIFF_XDL_CLR(options, NEED_MINIMAL);
else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
DIFF_XDL_SET(options, IGNORE_WHITESPACE);
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
else if (opt_arg(arg, '\0', "inter-hunk-context",
&options->interhunkcontext))
;
+ else if (!strcmp(arg, "-W"))
+ DIFF_OPT_SET(options, FUNCCONTEXT);
+ else if (!strcmp(arg, "--function-context"))
+ DIFF_OPT_SET(options, FUNCCONTEXT);
+ else if (!strcmp(arg, "--no-function-context"))
+ DIFF_OPT_CLR(options, FUNCCONTEXT);
else if ((argcount = parse_long_opt("output", av, &optarg))) {
options->file = fopen(optarg, "w");
if (!options->file)