@@ -4936,6 +4936,7 @@ static int diff_opt_stat(const struct option *opt, const char *value, int unset)
4936
4936
} else
4937
4937
BUG ("%s should not get here" , opt -> long_name );
4938
4938
4939
+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
4939
4940
options -> output_format |= DIFF_FORMAT_DIFFSTAT ;
4940
4941
options -> stat_name_width = name_width ;
4941
4942
options -> stat_graph_width = graph_width ;
@@ -4955,6 +4956,7 @@ static int parse_dirstat_opt(struct diff_options *options, const char *params)
4955
4956
* The caller knows a dirstat-related option is given from the command
4956
4957
* line; allow it to say "return this_function();"
4957
4958
*/
4959
+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
4958
4960
options -> output_format |= DIFF_FORMAT_DIRSTAT ;
4959
4961
return 1 ;
4960
4962
}
@@ -5154,6 +5156,7 @@ static int diff_opt_compact_summary(const struct option *opt,
5154
5156
options -> flags .stat_with_summary = 0 ;
5155
5157
} else {
5156
5158
options -> flags .stat_with_summary = 1 ;
5159
+ options -> output_format &= ~DIFF_FORMAT_NO_OUTPUT ;
5157
5160
options -> output_format |= DIFF_FORMAT_DIFFSTAT ;
5158
5161
}
5159
5162
return 0 ;
@@ -5499,9 +5502,8 @@ struct option *add_diff_options(const struct option *opts,
5499
5502
OPT_BITOP ('p' , "patch" , & options -> output_format ,
5500
5503
N_ ("generate patch" ),
5501
5504
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 ),
5505
5507
OPT_BITOP ('u' , NULL , & options -> output_format ,
5506
5508
N_ ("generate patch" ),
5507
5509
DIFF_FORMAT_PATCH , DIFF_FORMAT_NO_OUTPUT ),
@@ -5510,9 +5512,9 @@ struct option *add_diff_options(const struct option *opts,
5510
5512
PARSE_OPT_NONEG | PARSE_OPT_OPTARG , diff_opt_unified ),
5511
5513
OPT_BOOL ('W' , "function-context" , & options -> flags .funccontext ,
5512
5514
N_ ("generate diffs with <n> lines context" )),
5513
- OPT_BIT_F (0 , "raw" , & options -> output_format ,
5515
+ OPT_BITOP (0 , "raw" , & options -> output_format ,
5514
5516
N_ ("generate the diff in raw format" ),
5515
- DIFF_FORMAT_RAW , PARSE_OPT_NONEG ),
5517
+ DIFF_FORMAT_RAW , DIFF_FORMAT_NO_OUTPUT ),
5516
5518
OPT_BITOP (0 , "patch-with-raw" , & options -> output_format ,
5517
5519
N_ ("synonym for '-p --raw'" ),
5518
5520
DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW ,
@@ -5521,12 +5523,12 @@ struct option *add_diff_options(const struct option *opts,
5521
5523
N_ ("synonym for '-p --stat'" ),
5522
5524
DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT ,
5523
5525
DIFF_FORMAT_NO_OUTPUT ),
5524
- OPT_BIT_F (0 , "numstat" , & options -> output_format ,
5526
+ OPT_BITOP (0 , "numstat" , & options -> output_format ,
5525
5527
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 ,
5528
5530
N_ ("output only the last line of --stat" ),
5529
- DIFF_FORMAT_SHORTSTAT , PARSE_OPT_NONEG ),
5531
+ DIFF_FORMAT_SHORTSTAT , DIFF_FORMAT_NO_OUTPUT ),
5530
5532
OPT_CALLBACK_F ('X' , "dirstat" , options , N_ ("<param1,param2>..." ),
5531
5533
N_ ("output the distribution of relative amount of changes for each sub-directory" ),
5532
5534
PARSE_OPT_NONEG | PARSE_OPT_OPTARG ,
@@ -5542,9 +5544,9 @@ struct option *add_diff_options(const struct option *opts,
5542
5544
OPT_BIT_F (0 , "check" , & options -> output_format ,
5543
5545
N_ ("warn if changes introduce conflict markers or whitespace errors" ),
5544
5546
DIFF_FORMAT_CHECKDIFF , PARSE_OPT_NONEG ),
5545
- OPT_BIT_F (0 , "summary" , & options -> output_format ,
5547
+ OPT_BITOP (0 , "summary" , & options -> output_format ,
5546
5548
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 ),
5548
5550
OPT_BIT_F (0 , "name-only" , & options -> output_format ,
5549
5551
N_ ("show only names of changed files" ),
5550
5552
DIFF_FORMAT_NAME , PARSE_OPT_NONEG ),
0 commit comments