@@ -42,6 +42,7 @@ static int blank_boundary;
42
42
static int incremental ;
43
43
static int xdl_opts ;
44
44
static int abbrev = -1 ;
45
+ static int no_whole_file_rename ;
45
46
46
47
static enum date_mode blame_date_mode = DATE_ISO8601 ;
47
48
static size_t blame_date_width ;
@@ -1226,7 +1227,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
1226
1227
* The first pass looks for unrenamed path to optimize for
1227
1228
* common cases, then we look for renames in the second pass.
1228
1229
*/
1229
- for (pass = 0 ; pass < 2 ; pass ++ ) {
1230
+ for (pass = 0 ; pass < 2 - no_whole_file_rename ; pass ++ ) {
1230
1231
struct origin * (* find )(struct scoreboard * ,
1231
1232
struct commit * , struct origin * );
1232
1233
find = pass ? find_rename : find_origin ;
@@ -2403,6 +2404,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
2403
2404
init_revisions (& revs , NULL );
2404
2405
revs .date_mode = blame_date_mode ;
2405
2406
DIFF_OPT_SET (& revs .diffopt , ALLOW_TEXTCONV );
2407
+ DIFF_OPT_SET (& revs .diffopt , FOLLOW_RENAMES );
2406
2408
2407
2409
save_commit_buffer = 0 ;
2408
2410
dashdash_pos = 0 ;
@@ -2426,6 +2428,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
2426
2428
parse_revision_opt (& revs , & ctx , options , blame_opt_usage );
2427
2429
}
2428
2430
parse_done :
2431
+ no_whole_file_rename = !DIFF_OPT_TST (& revs .diffopt , FOLLOW_RENAMES );
2432
+ DIFF_OPT_CLR (& revs .diffopt , FOLLOW_RENAMES );
2429
2433
argc = parse_options_end (& ctx );
2430
2434
2431
2435
if (0 < abbrev )
0 commit comments