@@ -53,9 +53,9 @@ pub fn blame_file(
53
53
} ;
54
54
55
55
let cache: Option < gix:: commitgraph:: Graph > =
56
- repo. commit_graph_if_enabled ( ) . expect ( "TODO" ) ;
56
+ repo. commit_graph_if_enabled ( ) ? ;
57
57
let mut resource_cache =
58
- repo. diff_resource_cache_for_tree_diff ( ) . expect ( "TODO" ) ;
58
+ repo. diff_resource_cache_for_tree_diff ( ) ? ;
59
59
60
60
let options: gix_blame:: Options = Default :: default ( ) ;
61
61
@@ -66,8 +66,7 @@ pub fn blame_file(
66
66
& mut resource_cache,
67
67
file_path. into ( ) ,
68
68
options,
69
- )
70
- . expect ( "TODO" ) ;
69
+ ) ?;
71
70
72
71
let commit_id = if let Some ( commit_id) = commit_id {
73
72
commit_id
@@ -77,15 +76,10 @@ pub fn blame_file(
77
76
utils:: get_head_repo ( & repo) ?
78
77
} ;
79
78
80
- let unique_commit_ids: HashSet < _ > = outcome
79
+ let unique_commit_ids: HashSet < CommitId > = outcome
81
80
. entries
82
81
. 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 ( ) )
89
83
. collect ( ) ;
90
84
let mut commit_ids = Vec :: with_capacity ( unique_commit_ids. len ( ) ) ;
91
85
commit_ids. extend ( unique_commit_ids) ;
@@ -102,10 +96,7 @@ pub fn blame_file(
102
96
let lines: Vec < ( Option < BlameHunk > , String ) > = outcome
103
97
. entries_with_lines ( )
104
98
. 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 ( ) ;
109
100
let start_in_blamed_file =
110
101
entry. start_in_blamed_file as usize ;
111
102
@@ -126,7 +117,8 @@ pub fn blame_file(
126
117
author : commit_info. author . clone ( ) ,
127
118
time : commit_info. time ,
128
119
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 ,
130
122
} ) ,
131
123
trimmed_line,
132
124
) ;
0 commit comments