@@ -3140,16 +3140,19 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
31403140 return stat_opt (options , av );
31413141
31423142 /* renames options */
3143- else if (!prefixcmp (arg , "-B" )) {
3143+ else if (!prefixcmp (arg , "-B" ) || !prefixcmp (arg , "--break-rewrites=" ) ||
3144+ !strcmp (arg , "--break-rewrites" )) {
31443145 if ((options -> break_opt = diff_scoreopt_parse (arg )) == -1 )
31453146 return -1 ;
31463147 }
3147- else if (!prefixcmp (arg , "-M" )) {
3148+ else if (!prefixcmp (arg , "-M" ) || !prefixcmp (arg , "--detect-renames=" ) ||
3149+ !strcmp (arg , "--detect-renames" )) {
31483150 if ((options -> rename_score = diff_scoreopt_parse (arg )) == -1 )
31493151 return -1 ;
31503152 options -> detect_rename = DIFF_DETECT_RENAME ;
31513153 }
3152- else if (!prefixcmp (arg , "-C" )) {
3154+ else if (!prefixcmp (arg , "-C" ) || !prefixcmp (arg , "--detect-copies=" ) ||
3155+ !strcmp (arg , "--detect-copies" )) {
31533156 if (options -> detect_rename == DIFF_DETECT_COPY )
31543157 DIFF_OPT_SET (options , FIND_COPIES_HARDER );
31553158 if ((options -> rename_score = diff_scoreopt_parse (arg )) == -1 )
@@ -3323,7 +3326,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
33233326 return 1 ;
33243327}
33253328
3326- static int parse_num (const char * * cp_p )
3329+ int parse_rename_score (const char * * cp_p )
33273330{
33283331 unsigned long num , scale ;
33293332 int ch , dot ;
@@ -3366,10 +3369,26 @@ static int diff_scoreopt_parse(const char *opt)
33663369 if (* opt ++ != '-' )
33673370 return -1 ;
33683371 cmd = * opt ++ ;
3372+ if (cmd == '-' ) {
3373+ /* convert the long-form arguments into short-form versions */
3374+ if (!prefixcmp (opt , "break-rewrites" )) {
3375+ opt += strlen ("break-rewrites" );
3376+ if (* opt == 0 || * opt ++ == '=' )
3377+ cmd = 'B' ;
3378+ } else if (!prefixcmp (opt , "detect-copies" )) {
3379+ opt += strlen ("detect-copies" );
3380+ if (* opt == 0 || * opt ++ == '=' )
3381+ cmd = 'C' ;
3382+ } else if (!prefixcmp (opt , "detect-renames" )) {
3383+ opt += strlen ("detect-renames" );
3384+ if (* opt == 0 || * opt ++ == '=' )
3385+ cmd = 'M' ;
3386+ }
3387+ }
33693388 if (cmd != 'M' && cmd != 'C' && cmd != 'B' )
33703389 return -1 ; /* that is not a -M, -C nor -B option */
33713390
3372- opt1 = parse_num (& opt );
3391+ opt1 = parse_rename_score (& opt );
33733392 if (cmd != 'B' )
33743393 opt2 = 0 ;
33753394 else {
@@ -3379,7 +3398,7 @@ static int diff_scoreopt_parse(const char *opt)
33793398 return -1 ; /* we expect -B80/99 or -B80 */
33803399 else {
33813400 opt ++ ;
3382- opt2 = parse_num (& opt );
3401+ opt2 = parse_rename_score (& opt );
33833402 }
33843403 }
33853404 if (* opt != 0 )
0 commit comments