diff-parseopt: convert --name-status
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 21, 2019 at 18:16 UTC
a23874726b077c8ebb19a32855665bce04875b75
1 file changed
+4
-3
diff.c
+4
-3
@@ -4952,6 +4952,9 @@ static void prep_parse_options(struct diff_options *options)
4952
OPT_BIT_F(0, "name-only", &options->output_format,
4953
N_("show only names of changed files"),
4954
DIFF_FORMAT_NAME, PARSE_OPT_NONEG),
4955
+ OPT_BIT_F(0, "name-status", &options->output_format,
4956
+ N_("show only names and status of changed files"),
4957
+ DIFF_FORMAT_NAME_STATUS, PARSE_OPT_NONEG),
4958
OPT_END()
4959
};
4960
@@ -4980,9 +4983,7 @@ int diff_opt_parse(struct diff_options *options,
4983
return ac;
4984
4985
/* Output format options */
4983
- if (!strcmp(arg, "--name-status"))
4984
- options->output_format |= DIFF_FORMAT_NAME_STATUS;
4985
- else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch"))
4986
+ if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch"))
4987
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
4988
else if (starts_with(arg, "--stat"))
4989
/* --stat, --stat-width, --stat-name-width, or --stat-count */