@@ -53,9 +53,9 @@ pub fn blame_file(
5353 } ;
5454
5555 let cache: Option < gix:: commitgraph:: Graph > =
56- repo. commit_graph_if_enabled ( ) . expect ( "TODO" ) ;
56+ repo. commit_graph_if_enabled ( ) ? ;
5757 let mut resource_cache =
58- repo. diff_resource_cache_for_tree_diff ( ) . expect ( "TODO" ) ;
58+ repo. diff_resource_cache_for_tree_diff ( ) ? ;
5959
6060 let options: gix_blame:: Options = Default :: default ( ) ;
6161
@@ -66,8 +66,7 @@ pub fn blame_file(
6666 & mut resource_cache,
6767 file_path. into ( ) ,
6868 options,
69- )
70- . expect ( "TODO" ) ;
69+ ) ?;
7170
7271 let commit_id = if let Some ( commit_id) = commit_id {
7372 commit_id
@@ -77,15 +76,10 @@ pub fn blame_file(
7776 utils:: get_head_repo ( & repo) ?
7877 } ;
7978
80- let unique_commit_ids: HashSet < _ > = outcome
79+ let unique_commit_ids: HashSet < CommitId > = outcome
8180 . entries
8281 . iter ( )
83- . map ( |entry| {
84- CommitId :: new (
85- git2:: Oid :: from_bytes ( entry. commit_id . as_bytes ( ) )
86- . expect ( "TODO" ) ,
87- )
88- } )
82+ . map ( |entry| entry. commit_id . into ( ) )
8983 . collect ( ) ;
9084 let mut commit_ids = Vec :: with_capacity ( unique_commit_ids. len ( ) ) ;
9185 commit_ids. extend ( unique_commit_ids) ;
@@ -102,10 +96,7 @@ pub fn blame_file(
10296 let lines: Vec < ( Option < BlameHunk > , String ) > = outcome
10397 . entries_with_lines ( )
10498 . flat_map ( |( entry, lines) | {
105- let commit_id = CommitId :: new (
106- git2:: Oid :: from_bytes ( entry. commit_id . as_bytes ( ) )
107- . expect ( "TODO" ) ,
108- ) ;
99+ let commit_id = entry. commit_id . into ( ) ;
109100 let start_in_blamed_file =
110101 entry. start_in_blamed_file as usize ;
111102
@@ -126,7 +117,8 @@ pub fn blame_file(
126117 author : commit_info. author . clone ( ) ,
127118 time : commit_info. time ,
128119 start_line : start_in_blamed_file + i,
129- end_line : start_in_blamed_file + i,
120+ end_line : start_in_blamed_file
121+ + i + 1 ,
130122 } ) ,
131123 trimmed_line,
132124 ) ;
0 commit comments