diff-parseopt: convert --numstat and --shortstat

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 Feb 16, 2019 at 18:36 UTC e56736203eb4076979358130c299e10eecc93d4d
1 file changed +7 -5
diff.c
+7 -5
@@ -4905,6 +4905,12 @@ static void prep_parse_options(struct diff_options *options)
4905 N_("synonym for '-p --raw'"),
4906 DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW,
4907 DIFF_FORMAT_NO_OUTPUT),
4908 + OPT_BIT_F(0, "numstat", &options->output_format,
4909 + N_("machine friendly --stat"),
4910 + DIFF_FORMAT_NUMSTAT, PARSE_OPT_NONEG),
4911 + OPT_BIT_F(0, "shortstat", &options->output_format,
4912 + N_("output only the last line of --stat"),
4913 + DIFF_FORMAT_SHORTSTAT, PARSE_OPT_NONEG),
4914 OPT_END()
4915 };
4916
@@ -4933,11 +4939,7 @@ int diff_opt_parse(struct diff_options *options,
4939 return ac;
4940
4941 /* Output format options */
4936 - if (!strcmp(arg, "--numstat"))
4937 - options->output_format |= DIFF_FORMAT_NUMSTAT;
4938 - else if (!strcmp(arg, "--shortstat"))
4939 - options->output_format |= DIFF_FORMAT_SHORTSTAT;
4940 - else if (skip_prefix(arg, "-X", &arg) ||
4942 + if (skip_prefix(arg, "-X", &arg) ||
4943 skip_to_optional_arg(arg, "--dirstat", &arg))
4944 return parse_dirstat_opt(options, arg);
4945 else if (!strcmp(arg, "--cumulative"))