File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2828,6 +2828,13 @@ extern "C" {
2828
2828
repo : * mut git_repository ,
2829
2829
reference : * const git_reference ,
2830
2830
) -> 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 ;
2831
2838
pub fn git_annotated_commit_free ( commit : * mut git_annotated_commit ) ;
2832
2839
pub fn git_merge_init_options ( opts : * mut git_merge_options , version : c_uint ) -> c_int ;
2833
2840
pub fn git_merge (
Original file line number Diff line number Diff line change @@ -1442,6 +1442,29 @@ impl Repository {
1442
1442
}
1443
1443
}
1444
1444
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
+
1445
1468
/// Create a new action signature with default user and now timestamp.
1446
1469
///
1447
1470
/// 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