File tree Expand file tree Collapse file tree
gitoxide-core/src/repository Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ pub fn merge_base(
1313 bail ! ( "Only 'human' format is currently supported" ) ;
1414 }
1515 repo. object_cache_size_if_unset ( 50 * 1024 * 1024 ) ;
16- let first_id = repo . rev_parse_single ( first. as_str ( ) ) ?;
16+ let first_id = commit_id ( & repo , first. as_str ( ) ) ?;
1717 let other_ids: Vec < _ > = others
1818 . iter ( )
19- . map ( |other| repo . rev_parse_single ( other. as_str ( ) ) . map ( gix :: Id :: detach ) )
19+ . map ( |other| commit_id ( & repo , other. as_str ( ) ) )
2020 . collect :: < Result < _ , _ > > ( ) ?;
2121
2222 let cache = repo. commit_graph_if_enabled ( ) ?;
@@ -30,3 +30,7 @@ pub fn merge_base(
3030 }
3131 Ok ( ( ) )
3232}
33+
34+ fn commit_id ( repo : & gix:: Repository , revspec : & str ) -> anyhow:: Result < gix:: ObjectId > {
35+ Ok ( repo. rev_parse_single ( revspec) ?. object ( ) ?. peel_to_commit ( ) ?. id )
36+ }
You can’t perform that action at this time.
0 commit comments