@@ -4936,6 +4936,7 @@ static int diff_opt_stat(const struct option *opt, const char *value, int unset)
49364936 } else
49374937 BUG ("%s should not get here" , opt -> long_name );
49384938
4939+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
49394940 options -> output_format |= DIFF_FORMAT_DIFFSTAT ;
49404941 options -> stat_name_width = name_width ;
49414942 options -> stat_graph_width = graph_width ;
@@ -4955,6 +4956,7 @@ static int parse_dirstat_opt(struct diff_options *options, const char *params)
49554956 * The caller knows a dirstat-related option is given from the command
49564957 * line; allow it to say "return this_function();"
49574958 */
4959+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
49584960 options -> output_format |= DIFF_FORMAT_DIRSTAT ;
49594961 return 1 ;
49604962}
@@ -5154,6 +5156,7 @@ static int diff_opt_compact_summary(const struct option *opt,
51545156 options -> flags .stat_with_summary = 0 ;
51555157 } else {
51565158 options -> flags .stat_with_summary = 1 ;
5159+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
51575160 options -> output_format |= DIFF_FORMAT_DIFFSTAT ;
51585161 }
51595162 return 0 ;
@@ -5499,9 +5502,8 @@ struct option *add_diff_options(const struct option *opts,
54995502 OPT_BITOP ('p' , "patch" , & options -> output_format ,
55005503 N_ ("generate patch" ),
55015504 DIFF_FORMAT_PATCH , DIFF_FORMAT_NO_OUTPUT ),
5502- OPT_BIT_F ('s' , "no-patch" , & options -> output_format ,
5503- N_ ("suppress diff output" ),
5504- DIFF_FORMAT_NO_OUTPUT , PARSE_OPT_NONEG ),
5505+ OPT_SET_INT ('s' , "no-patch" , & options -> output_format ,
5506+ N_ ("suppress diff output" ), DIFF_FORMAT_NO_OUTPUT ),
55055507 OPT_BITOP ('u' , NULL , & options -> output_format ,
55065508 N_ ("generate patch" ),
55075509 DIFF_FORMAT_PATCH , DIFF_FORMAT_NO_OUTPUT ),
@@ -5510,9 +5512,9 @@ struct option *add_diff_options(const struct option *opts,
55105512 PARSE_OPT_NONEG | PARSE_OPT_OPTARG , diff_opt_unified ),
55115513 OPT_BOOL ('W' , "function-context" , & options -> flags .funccontext ,
55125514 N_ ("generate diffs with <n> lines context" )),
5513- OPT_BIT_F (0 , "raw" , & options -> output_format ,
5515+ OPT_BITOP (0 , "raw" , & options -> output_format ,
55145516 N_ ("generate the diff in raw format" ),
5515- DIFF_FORMAT_RAW , PARSE_OPT_NONEG ),
5517+ DIFF_FORMAT_RAW , DIFF_FORMAT_NO_OUTPUT ),
55165518 OPT_BITOP (0 , "patch-with-raw" , & options -> output_format ,
55175519 N_ ("synonym for '-p --raw'" ),
55185520 DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW ,
@@ -5521,12 +5523,12 @@ struct option *add_diff_options(const struct option *opts,
55215523 N_ ("synonym for '-p --stat'" ),
55225524 DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT ,
55235525 DIFF_FORMAT_NO_OUTPUT ),
5524- OPT_BIT_F (0 , "numstat" , & options -> output_format ,
5526+ OPT_BITOP (0 , "numstat" , & options -> output_format ,
55255527 N_ ("machine friendly --stat" ),
5526- DIFF_FORMAT_NUMSTAT , PARSE_OPT_NONEG ),
5527- OPT_BIT_F (0 , "shortstat" , & options -> output_format ,
5528+ DIFF_FORMAT_NUMSTAT , DIFF_FORMAT_NO_OUTPUT ),
5529+ OPT_BITOP (0 , "shortstat" , & options -> output_format ,
55285530 N_ ("output only the last line of --stat" ),
5529- DIFF_FORMAT_SHORTSTAT , PARSE_OPT_NONEG ),
5531+ DIFF_FORMAT_SHORTSTAT , DIFF_FORMAT_NO_OUTPUT ),
55305532 OPT_CALLBACK_F ('X' , "dirstat" , options , N_ ("<param1,param2>..." ),
55315533 N_ ("output the distribution of relative amount of changes for each sub-directory" ),
55325534 PARSE_OPT_NONEG | PARSE_OPT_OPTARG ,
@@ -5542,9 +5544,9 @@ struct option *add_diff_options(const struct option *opts,
55425544 OPT_BIT_F (0 , "check" , & options -> output_format ,
55435545 N_ ("warn if changes introduce conflict markers or whitespace errors" ),
55445546 DIFF_FORMAT_CHECKDIFF , PARSE_OPT_NONEG ),
5545- OPT_BIT_F (0 , "summary" , & options -> output_format ,
5547+ OPT_BITOP (0 , "summary" , & options -> output_format ,
55465548 N_ ("condensed summary such as creations, renames and mode changes" ),
5547- DIFF_FORMAT_SUMMARY , PARSE_OPT_NONEG ),
5549+ DIFF_FORMAT_SUMMARY , DIFF_FORMAT_NO_OUTPUT ),
55485550 OPT_BIT_F (0 , "name-only" , & options -> output_format ,
55495551 N_ ("show only names of changed files" ),
55505552 DIFF_FORMAT_NAME , PARSE_OPT_NONEG ),
0 commit comments