diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-19 10:49:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-19 10:49:13 -0700 |
commit | 9b55aa03daebf43067021b7d58abea249229987b (patch) | |
tree | 1ca8767031f5f0968d8bc96bb8c2b192b7b94a9b /diff.c | |
parent | 662384c4996c7bc46322dc6d4f5afafa6e069d40 (diff) | |
parent | 14937c2c06e63f93f65e1bc6693b95d4e54053d7 (diff) | |
download | git-9b55aa03daebf43067021b7d58abea249229987b.tar.gz |
Merge branch 'rs/diff-whole-function'
* rs/diff-whole-function:
diff: add option to show whole functions as context
xdiff: factor out get_func_line()
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2169,6 +2169,8 @@ static void builtin_diff(const char *name_a, 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) @@ -3536,6 +3538,12 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) 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) |