@@ -4623,9 +4623,7 @@ int diff_opt_parse(struct diff_options *options,
46234623 else if (!strcmp (arg , "--no-follow" )) {
46244624 options -> flags .follow_renames = 0 ;
46254625 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" )) {
46294627 int value = git_config_colorbool (NULL , arg );
46304628 if (value < 0 )
46314629 return error ("option `color' expects \"always\", \"auto\", or \"never\"" );
@@ -4645,14 +4643,9 @@ int diff_opt_parse(struct diff_options *options,
46454643 if (cm < 0 )
46464644 die ("bad --color-moved argument: %s" , arg );
46474645 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 )) {
46534647 options -> use_color = 1 ;
46544648 options -> word_diff = DIFF_WORDS_COLOR ;
4655- options -> word_regex = arg ;
46564649 }
46574650 else if (!strcmp (arg , "--word-diff" )) {
46584651 if (options -> word_diff == DIFF_WORDS_NONE )
@@ -4691,15 +4684,10 @@ int diff_opt_parse(struct diff_options *options,
46914684 options -> flags .textconv_set_via_cmdline = 1 ;
46924685 } else if (!strcmp (arg , "--no-textconv" ))
46934686 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" )) {
46984688 options -> flags .override_submodule_config = 1 ;
46994689 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" ))
47034691 return parse_submodule_opt (options , arg );
47044692 else if (skip_prefix (arg , "--ws-error-highlight=" , & arg ))
47054693 return parse_ws_error_highlight_opt (options , arg );
0 commit comments