Skip to content

Commit e567362

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent c659f30 commit e567362

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

diff.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4905,6 +4905,12 @@ static void prep_parse_options(struct diff_options *options)
49054905
N_("synonym for '-p --raw'"),
49064906
DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW,
49074907
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),
49084914
OPT_END()
49094915
};
49104916

@@ -4933,11 +4939,7 @@ int diff_opt_parse(struct diff_options *options,
49334939
return ac;
49344940

49354941
/* 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) ||
49414943
skip_to_optional_arg(arg, "--dirstat", &arg))
49424944
return parse_dirstat_opt(options, arg);
49434945
else if (!strcmp(arg, "--cumulative"))

0 commit comments

Comments
 (0)