diff.c: convert -W|--[no-]function-context
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Jan 27, 2019 at 07:35 UTC
7fd9a1ba039b683f596d10bacbf892fa5e8f202f
1 file changed
+2
-6
diff.c
+2
-6
@@ -4896,6 +4896,8 @@ static void prep_parse_options(struct diff_options *options)
4896
OPT_CALLBACK_F('U', "unified", options, N_("<n>"),
4897
N_("generate diffs with <n> lines context"),
4898
PARSE_OPT_NONEG, diff_opt_unified),
4899
+ OPT_BOOL('W', "function-context", &options->flags.funccontext,
4900
+ N_("generate diffs with <n> lines context")),
4901
OPT_END()
4902
};
4903
@@ -5212,12 +5214,6 @@ int diff_opt_parse(struct diff_options *options,
5214
else if (opt_arg(arg, '\0', "inter-hunk-context",
5215
&options->interhunkcontext))
5216
;
5215
- else if (!strcmp(arg, "-W"))
5216
- options->flags.funccontext = 1;
5217
- else if (!strcmp(arg, "--function-context"))
5218
- options->flags.funccontext = 1;
5219
- else if (!strcmp(arg, "--no-function-context"))
5220
- options->flags.funccontext = 0;
5217
else if ((argcount = parse_long_opt("output", av, &optarg))) {
5218
char *path = prefix_filename(prefix, optarg);
5219
options->file = xfopen(path, "w");