diff-parseopt: convert -s|--no-patch
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
e01df7a33d368e2bd2ce7b72b007bc18c51875d8
1 file changed
+4
-3
diff.c
+4
-3
@@ -4906,6 +4906,9 @@ static void prep_parse_options(struct diff_options *options)
4906
OPT_BITOP('p', "patch", &options->output_format,
4907
N_("generate patch"),
4908
DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT),
4909
+ OPT_BIT_F('s', "no-patch", &options->output_format,
4910
+ N_("suppress diff output"),
4911
+ DIFF_FORMAT_NO_OUTPUT, PARSE_OPT_NONEG),
4912
OPT_BITOP('u', NULL, &options->output_format,
4913
N_("generate patch"),
4914
DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT),
@@ -4983,9 +4986,7 @@ int diff_opt_parse(struct diff_options *options,
4986
return ac;
4987
4988
/* Output format options */
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
+ if (starts_with(arg, "--stat"))
4990
/* --stat, --stat-width, --stat-name-width, or --stat-count */
4991
return stat_opt(options, av);
4992
else if (!strcmp(arg, "--compact-summary")) {