@@ -4623,9 +4623,7 @@ int diff_opt_parse(struct diff_options *options,
4623
4623
else if (!strcmp (arg , "--no-follow" )) {
4624
4624
options -> flags .follow_renames = 0 ;
4625
4625
options -> flags .default_follow_renames = 0 ;
4626
- } else if (!strcmp (arg , "--color" ))
4627
- options -> use_color = 1 ;
4628
- else if (skip_prefix (arg , "--color=" , & arg )) {
4626
+ } else if (skip_to_optional_arg_default (arg , "--color" , & arg , "always" )) {
4629
4627
int value = git_config_colorbool (NULL , arg );
4630
4628
if (value < 0 )
4631
4629
return error ("option `color' expects \"always\", \"auto\", or \"never\"" );
@@ -4645,14 +4643,9 @@ int diff_opt_parse(struct diff_options *options,
4645
4643
if (cm < 0 )
4646
4644
die ("bad --color-moved argument: %s" , arg );
4647
4645
options -> color_moved = cm ;
4648
- } else if (!strcmp (arg , "--color-words" )) {
4649
- options -> use_color = 1 ;
4650
- options -> word_diff = DIFF_WORDS_COLOR ;
4651
- }
4652
- else if (skip_prefix (arg , "--color-words=" , & arg )) {
4646
+ } else if (skip_to_optional_arg_default (arg , "--color-words" , & options -> word_regex , NULL )) {
4653
4647
options -> use_color = 1 ;
4654
4648
options -> word_diff = DIFF_WORDS_COLOR ;
4655
- options -> word_regex = arg ;
4656
4649
}
4657
4650
else if (!strcmp (arg , "--word-diff" )) {
4658
4651
if (options -> word_diff == DIFF_WORDS_NONE )
@@ -4691,15 +4684,10 @@ int diff_opt_parse(struct diff_options *options,
4691
4684
options -> flags .textconv_set_via_cmdline = 1 ;
4692
4685
} else if (!strcmp (arg , "--no-textconv" ))
4693
4686
options -> flags .allow_textconv = 0 ;
4694
- else if (!strcmp (arg , "--ignore-submodules" )) {
4695
- options -> flags .override_submodule_config = 1 ;
4696
- handle_ignore_submodules_arg (options , "all" );
4697
- } else if (skip_prefix (arg , "--ignore-submodules=" , & arg )) {
4687
+ else if (skip_to_optional_arg_default (arg , "--ignore-submodules" , & arg , "all" )) {
4698
4688
options -> flags .override_submodule_config = 1 ;
4699
4689
handle_ignore_submodules_arg (options , arg );
4700
- } else if (!strcmp (arg , "--submodule" ))
4701
- options -> submodule_format = DIFF_SUBMODULE_LOG ;
4702
- else if (skip_prefix (arg , "--submodule=" , & arg ))
4690
+ } else if (skip_to_optional_arg_default (arg , "--submodule" , & arg , "log" ))
4703
4691
return parse_submodule_opt (options , arg );
4704
4692
else if (skip_prefix (arg , "--ws-error-highlight=" , & arg ))
4705
4693
return parse_ws_error_highlight_opt (options , arg );
0 commit comments