@@ -391,6 +391,9 @@ struct blame_scoreboard {
391391
392392 /* callbacks */
393393 void (* on_sanity_fail )(struct blame_scoreboard * , int );
394+ void (* found_guilty_entry )(struct blame_entry * , void * );
395+
396+ void * found_guilty_entry_data ;
394397};
395398
396399static void sanity_check_refcnt (struct blame_scoreboard * );
@@ -1729,9 +1732,10 @@ static int emit_one_suspect_detail(struct blame_origin *suspect, int repeat)
17291732 * The blame_entry is found to be guilty for the range.
17301733 * Show it in incremental output.
17311734 */
1732- static void found_guilty_entry (struct blame_entry * ent ,
1733- struct progress_info * pi )
1735+ static void found_guilty_entry (struct blame_entry * ent , void * data )
17341736{
1737+ struct progress_info * pi = (struct progress_info * )data ;
1738+
17351739 if (incremental ) {
17361740 struct blame_origin * suspect = ent -> suspect ;
17371741
@@ -1754,11 +1758,6 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
17541758{
17551759 struct rev_info * revs = sb -> revs ;
17561760 struct commit * commit = prio_queue_get (& sb -> commits );
1757- struct progress_info pi = { NULL , 0 };
1758-
1759- if (show_progress )
1760- pi .progress = start_progress_delay (_ ("Blaming lines" ),
1761- sb -> num_lines , 50 , 1 );
17621761
17631762 while (commit ) {
17641763 struct blame_entry * ent ;
@@ -1800,7 +1799,8 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
18001799 suspect -> guilty = 1 ;
18011800 for (;;) {
18021801 struct blame_entry * next = ent -> next ;
1803- found_guilty_entry (ent , & pi );
1802+ if (sb -> found_guilty_entry )
1803+ sb -> found_guilty_entry (ent , sb -> found_guilty_entry_data );
18041804 if (next ) {
18051805 ent = next ;
18061806 continue ;
@@ -1816,8 +1816,6 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
18161816 if (sb -> debug ) /* sanity */
18171817 sanity_check_refcnt (sb );
18181818 }
1819-
1820- stop_progress (& pi .progress );
18211819}
18221820
18231821static const char * format_time (timestamp_t time , const char * tz_str ,
@@ -2550,6 +2548,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
25502548 char * final_commit_name = NULL ;
25512549 enum object_type type ;
25522550 struct commit * final_commit = NULL ;
2551+ struct progress_info pi = { NULL , 0 };
25532552
25542553 struct string_list range_list = STRING_LIST_INIT_NODUP ;
25552554 int output_option = 0 , opt = 0 ;
@@ -2905,8 +2904,16 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
29052904
29062905 read_mailmap (& mailmap , NULL );
29072906
2907+ sb .found_guilty_entry = & found_guilty_entry ;
2908+ sb .found_guilty_entry_data = & pi ;
2909+ if (show_progress )
2910+ pi .progress = start_progress_delay (_ ("Blaming lines" ),
2911+ sb .num_lines , 50 , 1 );
2912+
29082913 assign_blame (& sb , opt );
29092914
2915+ stop_progress (& pi .progress );
2916+
29102917 if (!incremental )
29112918 setup_pager ();
29122919
0 commit comments