@@ -134,6 +134,14 @@ impl BlameEntry {
134
134
}
135
135
}
136
136
}
137
+
138
+ fn from_unblamed_hunk ( unblamed_hunk : & UnblamedHunk , commit_id : ObjectId ) -> Self {
139
+ Self {
140
+ range_in_blamed_file : unblamed_hunk. range_in_blamed_file . clone ( ) ,
141
+ range_in_original_file : unblamed_hunk. range_in_destination . clone ( ) ,
142
+ commit_id,
143
+ }
144
+ }
137
145
}
138
146
139
147
#[ derive( Clone , Debug , PartialEq ) ]
@@ -744,16 +752,11 @@ pub fn blame_file<E>(
744
752
// remaining lines to it, even though we don’t explicitly check whether that is true
745
753
// here. We could perhaps use `needed_to_obtain` to compare `suspect` against an empty
746
754
// tree to validate this assumption.
747
- out. extend ( hunks_to_blame. iter ( ) . map ( |hunk| {
748
- BlameEntry :: new (
749
- hunk. range_in_blamed_file . clone ( ) ,
750
- // TODO
751
- // I don’t know whether it is correct to use `range_in_destination` for
752
- // this purpose.
753
- hunk. range_in_destination . clone ( ) ,
754
- suspect,
755
- )
756
- } ) ) ;
755
+ out. extend (
756
+ hunks_to_blame
757
+ . iter ( )
758
+ . map ( |hunk| BlameEntry :: from_unblamed_hunk ( hunk, suspect) ) ,
759
+ ) ;
757
760
758
761
hunks_to_blame = vec ! [ ] ;
759
762
@@ -777,16 +780,11 @@ pub fn blame_file<E>(
777
780
gix_diff:: tree:: recorder:: Change :: Addition { .. } => {
778
781
// Every line that has not been blamed yet on a commit, is expected to have been
779
782
// added when the file was added to the repository.
780
- out. extend ( hunks_to_blame. iter ( ) . map ( |hunk| {
781
- BlameEntry :: new (
782
- hunk. range_in_blamed_file . clone ( ) ,
783
- // TODO
784
- // I don’t know whether it is correct to use `range_in_destination` for
785
- // this purpose.
786
- hunk. range_in_destination . clone ( ) ,
787
- suspect,
788
- )
789
- } ) ) ;
783
+ out. extend (
784
+ hunks_to_blame
785
+ . iter ( )
786
+ . map ( |hunk| BlameEntry :: from_unblamed_hunk ( hunk, suspect) ) ,
787
+ ) ;
790
788
791
789
hunks_to_blame = vec ! [ ] ;
792
790
0 commit comments