@@ -42,6 +42,7 @@ static int blank_boundary;
4242static int incremental ;
4343static int xdl_opts ;
4444static int abbrev = -1 ;
45+ static int no_whole_file_rename ;
4546
4647static enum date_mode blame_date_mode = DATE_ISO8601 ;
4748static size_t blame_date_width ;
@@ -1226,7 +1227,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
12261227 * The first pass looks for unrenamed path to optimize for
12271228 * common cases, then we look for renames in the second pass.
12281229 */
1229- for (pass = 0 ; pass < 2 ; pass ++ ) {
1230+ for (pass = 0 ; pass < 2 - no_whole_file_rename ; pass ++ ) {
12301231 struct origin * (* find )(struct scoreboard * ,
12311232 struct commit * , struct origin * );
12321233 find = pass ? find_rename : find_origin ;
@@ -2403,6 +2404,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
24032404 init_revisions (& revs , NULL );
24042405 revs .date_mode = blame_date_mode ;
24052406 DIFF_OPT_SET (& revs .diffopt , ALLOW_TEXTCONV );
2407+ DIFF_OPT_SET (& revs .diffopt , FOLLOW_RENAMES );
24062408
24072409 save_commit_buffer = 0 ;
24082410 dashdash_pos = 0 ;
@@ -2426,6 +2428,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
24262428 parse_revision_opt (& revs , & ctx , options , blame_opt_usage );
24272429 }
24282430parse_done :
2431+ no_whole_file_rename = !DIFF_OPT_TST (& revs .diffopt , FOLLOW_RENAMES );
2432+ DIFF_OPT_CLR (& revs .diffopt , FOLLOW_RENAMES );
24292433 argc = parse_options_end (& ctx );
24302434
24312435 if (0 < abbrev )
0 commit comments