File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2828,6 +2828,13 @@ extern "C" {
28282828 repo : * mut git_repository ,
28292829 reference : * const git_reference ,
28302830 ) -> c_int ;
2831+ pub fn git_annotated_commit_from_fetchhead (
2832+ out : * mut * mut git_annotated_commit ,
2833+ repo : * mut git_repository ,
2834+ branch_name : * const c_char ,
2835+ remote_url : * const c_char ,
2836+ oid : * const git_oid ,
2837+ ) -> c_int ;
28312838 pub fn git_annotated_commit_free ( commit : * mut git_annotated_commit ) ;
28322839 pub fn git_merge_init_options ( opts : * mut git_merge_options , version : c_uint ) -> c_int ;
28332840 pub fn git_merge (
Original file line number Diff line number Diff line change @@ -1442,6 +1442,29 @@ impl Repository {
14421442 }
14431443 }
14441444
1445+ /// Creates a git_annotated_commit from FETCH_HEAD.
1446+ pub fn annotated_commit_from_fetchhead (
1447+ & self ,
1448+ branch_name : & str ,
1449+ remote_url : & str ,
1450+ id : & Oid ,
1451+ ) -> Result < AnnotatedCommit < ' _ > , Error > {
1452+ let branch_name = CString :: new ( branch_name) ?;
1453+ let remote_url = CString :: new ( remote_url) ?;
1454+
1455+ let mut ret = ptr:: null_mut ( ) ;
1456+ unsafe {
1457+ try_call ! ( raw:: git_annotated_commit_from_fetchhead(
1458+ & mut ret,
1459+ self . raw( ) ,
1460+ branch_name,
1461+ remote_url,
1462+ id. raw( )
1463+ ) ) ;
1464+ Ok ( AnnotatedCommit :: from_raw ( ret) )
1465+ }
1466+ }
1467+
14451468 /// Create a new action signature with default user and now timestamp.
14461469 ///
14471470 /// This looks up the user.name and user.email from the configuration and
You can’t perform that action at this time.
0 commit comments