diff-parseopt: convert --check
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 21 Feb 2019 11:16:04 +0000 (18:16 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Feb 2019 23:16:58 +0000 (15:16 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff --git a/diff.c b/diff.c
index 1cdbe8e6884eb2d329330c78ea0a9bdf53a4ec4f..5e16082091c20438ff3489ecadae5f9f696f1d46 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -4939,6 +4939,9 @@ static void prep_parse_options(struct diff_options *options)
                               N_("synonym for --dirstat=files,param1,param2..."),
                               PARSE_OPT_NONEG | PARSE_OPT_OPTARG,
                               diff_opt_dirstat),
+               OPT_BIT_F(0, "check", &options->output_format,
+                         N_("warn if changes introduce conflict markers or whitespace errors"),
+                         DIFF_FORMAT_CHECKDIFF, PARSE_OPT_NONEG),
                OPT_END()
        };
 
@@ -4967,9 +4970,7 @@ int diff_opt_parse(struct diff_options *options,
                return ac;
 
        /* Output format options */
-       if (!strcmp(arg, "--check"))
-               options->output_format |= DIFF_FORMAT_CHECKDIFF;
-       else if (!strcmp(arg, "--summary"))
+       if (!strcmp(arg, "--summary"))
                options->output_format |= DIFF_FORMAT_SUMMARY;
        else if (!strcmp(arg, "--patch-with-stat")) {
                enable_patch_output(&options->output_format);