@@ -4862,6 +4862,20 @@ static int diff_opt_color_moved(const struct option *opt,
48624862 return 0 ;
48634863}
48644864
4865+ static int diff_opt_color_moved_ws (const struct option * opt ,
4866+ const char * arg , int unset )
4867+ {
4868+ struct diff_options * options = opt -> value ;
4869+ unsigned cm ;
4870+
4871+ BUG_ON_OPT_NEG (unset );
4872+ cm = parse_color_moved_ws (arg );
4873+ if (cm & COLOR_MOVED_WS_ERROR )
4874+ return error (_ ("invalid mode '%s' in --color-moved-ws" ), arg );
4875+ options -> color_moved_ws_handling = cm ;
4876+ return 0 ;
4877+ }
4878+
48654879static int diff_opt_color_words (const struct option * opt ,
48664880 const char * arg , int unset )
48674881{
@@ -5363,6 +5377,9 @@ static void prep_parse_options(struct diff_options *options)
53635377 OPT_CALLBACK_F (0 , "color-moved" , options , N_ ("<mode>" ),
53645378 N_ ("move lines of code are colored differently" ),
53655379 PARSE_OPT_OPTARG , diff_opt_color_moved ),
5380+ OPT_CALLBACK_F (0 , "color-moved-ws" , options , N_ ("<mode>" ),
5381+ N_ ("how white spaces are ignored in --color-moved" ),
5382+ PARSE_OPT_NONEG , diff_opt_color_moved_ws ),
53665383
53675384 OPT_GROUP (N_ ("Diff other options" )),
53685385 OPT_CALLBACK_F (0 , "relative" , options , N_ ("<prefix>" ),
@@ -5430,8 +5447,6 @@ static void prep_parse_options(struct diff_options *options)
54305447int diff_opt_parse (struct diff_options * options ,
54315448 const char * * av , int ac , const char * prefix )
54325449{
5433- const char * arg = av [0 ];
5434-
54355450 if (!prefix )
54365451 prefix = "" ;
54375452
@@ -5442,21 +5457,7 @@ int diff_opt_parse(struct diff_options *options,
54425457 PARSE_OPT_ONE_SHOT |
54435458 PARSE_OPT_STOP_AT_NON_OPTION );
54445459
5445- if (ac )
5446- return ac ;
5447-
5448- /* flags options */
5449- if (skip_prefix (arg , "--color-moved-ws=" , & arg )) {
5450- unsigned cm = parse_color_moved_ws (arg );
5451- if (cm & COLOR_MOVED_WS_ERROR )
5452- return -1 ;
5453- options -> color_moved_ws_handling = cm ;
5454- }
5455-
5456- /* misc options */
5457- else
5458- return 0 ;
5459- return 1 ;
5460+ return ac ;
54605461}
54615462
54625463int parse_rename_score (const char * * cp_p )
0 commit comments