File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -329,17 +329,21 @@ pub fn file(
329
329
options. diff_algorithm ,
330
330
& mut stats,
331
331
) ?;
332
- hunks_to_blame = process_changes ( hunks_to_blame, changes, suspect, * parent_id) ;
332
+ hunks_to_blame = process_changes ( hunks_to_blame, changes. clone ( ) , suspect, * parent_id) ;
333
333
if let Some ( ref mut blame_path) = blame_path {
334
- let blame_path_entry = BlamePathEntry {
335
- source_file_path : current_file_path. clone ( ) ,
336
- previous_source_file_path : Some ( current_file_path. clone ( ) ) ,
337
- commit_id : suspect,
338
- blob_id : id,
339
- previous_blob_id : previous_id,
340
- index,
341
- } ;
342
- blame_path. push ( blame_path_entry) ;
334
+ let has_blame_been_passed = hunks_to_blame. iter ( ) . any ( |hunk| hunk. has_suspect ( parent_id) ) ;
335
+
336
+ if has_blame_been_passed {
337
+ let blame_path_entry = BlamePathEntry {
338
+ source_file_path : current_file_path. clone ( ) ,
339
+ previous_source_file_path : Some ( current_file_path. clone ( ) ) ,
340
+ commit_id : suspect,
341
+ blob_id : id,
342
+ previous_blob_id : previous_id,
343
+ index,
344
+ } ;
345
+ blame_path. push ( blame_path_entry) ;
346
+ }
343
347
}
344
348
}
345
349
TreeDiffChange :: Rewrite {
You can’t perform that action at this time.
0 commit comments