diff.c: convert -W|--[no-]function-context
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sun, 27 Jan 2019 00:35:34 +0000 (07:35 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Jan 2019 00:28:18 +0000 (16:28 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff --git a/diff.c b/diff.c
index 093158244eca22120989bc50facb37bc0e676824..8f7010136257969190e37fcaceb51141bceb9dac 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -4896,6 +4896,8 @@ static void prep_parse_options(struct diff_options *options)
                OPT_CALLBACK_F('U', "unified", options, N_("<n>"),
                               N_("generate diffs with <n> lines context"),
                               PARSE_OPT_NONEG, diff_opt_unified),
+               OPT_BOOL('W', "function-context", &options->flags.funccontext,
+                        N_("generate diffs with <n> lines context")),
                OPT_END()
        };
 
@@ -5212,12 +5214,6 @@ int diff_opt_parse(struct diff_options *options,
        else if (opt_arg(arg, '\0', "inter-hunk-context",
                         &options->interhunkcontext))
                ;
-       else if (!strcmp(arg, "-W"))
-               options->flags.funccontext = 1;
-       else if (!strcmp(arg, "--function-context"))
-               options->flags.funccontext = 1;
-       else if (!strcmp(arg, "--no-function-context"))
-               options->flags.funccontext = 0;
        else if ((argcount = parse_long_opt("output", av, &optarg))) {
                char *path = prefix_filename(prefix, optarg);
                options->file = xfopen(path, "w");