@@ -4508,17 +4508,12 @@ int diff_opt_parse(struct diff_options *options,
4508
4508
options -> output_format |= DIFF_FORMAT_NUMSTAT ;
4509
4509
else if (!strcmp (arg , "--shortstat" ))
4510
4510
options -> output_format |= DIFF_FORMAT_SHORTSTAT ;
4511
- else if (!strcmp (arg , "-X" ) || !strcmp (arg , "--dirstat" ))
4512
- return parse_dirstat_opt (options , "" );
4513
- else if (skip_prefix (arg , "-X" , & arg ))
4514
- return parse_dirstat_opt (options , arg );
4515
- else if (skip_prefix (arg , "--dirstat=" , & arg ))
4511
+ else if (skip_prefix (arg , "-X" , & arg ) ||
4512
+ skip_to_optional_arg (arg , "--dirstat" , & arg ))
4516
4513
return parse_dirstat_opt (options , arg );
4517
4514
else if (!strcmp (arg , "--cumulative" ))
4518
4515
return parse_dirstat_opt (options , "cumulative" );
4519
- else if (!strcmp (arg , "--dirstat-by-file" ))
4520
- return parse_dirstat_opt (options , "files" );
4521
- else if (skip_prefix (arg , "--dirstat-by-file=" , & arg )) {
4516
+ else if (skip_to_optional_arg (arg , "--dirstat-by-file" , & arg )) {
4522
4517
parse_dirstat_opt (options , "files" );
4523
4518
return parse_dirstat_opt (options , arg );
4524
4519
}
@@ -4540,22 +4535,22 @@ int diff_opt_parse(struct diff_options *options,
4540
4535
return stat_opt (options , av );
4541
4536
4542
4537
/* renames options */
4543
- else if (starts_with (arg , "-B" ) || starts_with ( arg , "--break-rewrites=" ) ||
4544
- ! strcmp (arg , "--break-rewrites" )) {
4538
+ else if (starts_with (arg , "-B" ) ||
4539
+ skip_to_optional_arg (arg , "--break-rewrites" , NULL )) {
4545
4540
if ((options -> break_opt = diff_scoreopt_parse (arg )) == -1 )
4546
4541
return error ("invalid argument to -B: %s" , arg + 2 );
4547
4542
}
4548
- else if (starts_with (arg , "-M" ) || starts_with ( arg , "--find-renames=" ) ||
4549
- ! strcmp (arg , "--find-renames" )) {
4543
+ else if (starts_with (arg , "-M" ) ||
4544
+ skip_to_optional_arg (arg , "--find-renames" , NULL )) {
4550
4545
if ((options -> rename_score = diff_scoreopt_parse (arg )) == -1 )
4551
4546
return error ("invalid argument to -M: %s" , arg + 2 );
4552
4547
options -> detect_rename = DIFF_DETECT_RENAME ;
4553
4548
}
4554
4549
else if (!strcmp (arg , "-D" ) || !strcmp (arg , "--irreversible-delete" )) {
4555
4550
options -> irreversible_delete = 1 ;
4556
4551
}
4557
- else if (starts_with (arg , "-C" ) || starts_with ( arg , "--find-copies=" ) ||
4558
- ! strcmp (arg , "--find-copies" )) {
4552
+ else if (starts_with (arg , "-C" ) ||
4553
+ skip_to_optional_arg (arg , "--find-copies" , NULL )) {
4559
4554
if (options -> detect_rename == DIFF_DETECT_COPY )
4560
4555
options -> flags .find_copies_harder = 1 ;
4561
4556
if ((options -> rename_score = diff_scoreopt_parse (arg )) == -1 )
0 commit comments