File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,15 @@ impl From<Oid> for CommitId {
8888 }
8989}
9090
91+ impl From < gix:: Id < ' _ > > for CommitId {
92+ fn from ( object_id : gix:: Id < ' _ > ) -> Self {
93+ #[ allow( clippy:: expect_used) ]
94+ let oid = Oid :: from_bytes ( object_id. as_bytes ( ) ) . expect ( "`Oid::from_bytes(object_id.as_bytes())` is expected to never fail" ) ;
95+
96+ Self :: new ( oid)
97+ }
98+ }
99+
91100impl From < gix:: ObjectId > for CommitId {
92101 fn from ( object_id : gix:: ObjectId ) -> Self {
93102 #[ allow( clippy:: expect_used) ]
@@ -161,7 +170,7 @@ pub fn get_commits_info(
161170 parents : c
162171 . parents ( )
163172 . take ( 2 )
164- . map ( |p| CommitId :: new ( p. id ( ) ) )
173+ . map ( |p| CommitId ( p. id ( ) ) )
165174 . collect ( ) ,
166175 }
167176 } )
@@ -197,13 +206,11 @@ pub fn get_commit_info(
197206 author : author. to_string ( ) ,
198207 time : commit_ref. time ( ) ?. seconds ,
199208 id : commit. id ( ) . detach ( ) . into ( ) ,
200- parents : commit_ref
201- . parents
202- . iter ( )
209+ parents : commit
210+ . parent_ids ( )
203211 . take ( 2 )
204- . map ( |p| CommitId :: from_str_unchecked ( & p. to_string ( ) ) )
205- . collect :: < std:: result:: Result < Vec < _ > , _ > > ( ) ?
206- . into ( ) ,
212+ . map ( Into :: into)
213+ . collect ( ) ,
207214 } )
208215}
209216
You can’t perform that action at this time.
0 commit comments