diff-parseopt: convert --check
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
fc6af3e92afb24fd657c1381a8aab475b033b15a
1 file changed
+4
-3
diff.c
+4
-3
@@ -4939,6 +4939,9 @@ static void prep_parse_options(struct diff_options *options)
4939
N_("synonym for --dirstat=files,param1,param2..."),
4940
PARSE_OPT_NONEG | PARSE_OPT_OPTARG,
4941
diff_opt_dirstat),
4942
+ OPT_BIT_F(0, "check", &options->output_format,
4943
+ N_("warn if changes introduce conflict markers or whitespace errors"),
4944
+ DIFF_FORMAT_CHECKDIFF, PARSE_OPT_NONEG),
4945
OPT_END()
4946
};
4947
@@ -4967,9 +4970,7 @@ int diff_opt_parse(struct diff_options *options,
4970
return ac;
4971
4972
/* Output format options */
4970
- if (!strcmp(arg, "--check"))
4971
- options->output_format |= DIFF_FORMAT_CHECKDIFF;
4972
- else if (!strcmp(arg, "--summary"))
4973
+ if (!strcmp(arg, "--summary"))
4974
options->output_format |= DIFF_FORMAT_SUMMARY;
4975
else if (!strcmp(arg, "--patch-with-stat")) {
4976
enable_patch_output(&options->output_format);