@@ -8,6 +8,7 @@ use libc::{c_char, c_int, c_uchar, c_uint, c_void, size_t};
88#[ cfg( feature = "ssh" ) ]
99use libssh2_sys as libssh2;
1010use std:: ffi:: CStr ;
11+ use std:: os:: raw:: c_ushort;
1112
1213pub const GIT_OID_RAWSZ : usize = 20 ;
1314pub const GIT_OID_HEXSZ : usize = GIT_OID_RAWSZ * 2 ;
@@ -3854,6 +3855,82 @@ extern "C" {
38543855 ) -> c_int ;
38553856}
38563857
3858+ #[ repr( C ) ]
3859+ pub struct git_merge_file_options {
3860+ pub version : c_uint ,
3861+
3862+ /// Label for the ancestor file side of the conflict which will be prepended
3863+ /// to labels in diff3-format merge files.
3864+ pub ancestor_label : * const c_char ,
3865+
3866+ /// Label for our file side of the conflict which will be prepended
3867+ /// to labels in merge files.
3868+ pub our_label : * const c_char ,
3869+
3870+ /// Label for their file side of the conflict which will be prepended
3871+ /// to labels in merge files.
3872+ pub their_label : * const c_char ,
3873+
3874+ /// The file to favor in region conflicts.
3875+ pub favor : git_merge_file_favor_t ,
3876+
3877+ /// see `git_merge_file_flag_t`
3878+ pub flags : c_uint ,
3879+ pub marker_size : c_ushort ,
3880+ }
3881+
3882+ #[ repr( C ) ]
3883+ #[ derive( Copy , Clone ) ]
3884+ pub struct git_merge_file_input {
3885+ pub version : c_uint ,
3886+ /// Pointer to the contents of the file.
3887+ pub ptr : * const c_char ,
3888+ /// Size of the contents pointed to in `ptr`.
3889+ pub size : size_t ,
3890+ /// File name of the conflicted file, or `NULL` to not merge the path.
3891+ pub path : * const c_char ,
3892+ /// File mode of the conflicted file, or `0` to not merge the mode.
3893+ pub mode : c_uint ,
3894+ }
3895+
3896+ #[ repr( C ) ]
3897+ #[ derive( Copy , Clone ) ]
3898+ pub struct git_merge_file_result {
3899+ /// True if the output was automerged, false if the output contains
3900+ /// conflict markers.
3901+ pub automergeable : c_uint ,
3902+
3903+ /// The path that the resultant merge file should use, or NULL if a
3904+ /// filename conflict would occur.
3905+ pub path : * const c_char ,
3906+
3907+ /// The mode that the resultant merge file should use.
3908+ pub mode : c_uint ,
3909+
3910+ /// The contents of the merge.
3911+ pub ptr : * const c_char ,
3912+
3913+ /// The length of the merge contents.
3914+ pub len : size_t ,
3915+ }
3916+
3917+ extern "C" {
3918+ pub fn git_merge_file_options_init ( opts : * mut git_merge_file_options , version : c_uint )
3919+ -> c_int ;
3920+ pub fn git_merge_file_input_init ( opts : * mut git_merge_file_input , version : c_uint ) -> c_int ;
3921+
3922+ pub fn git_merge_file (
3923+ out : * mut git_merge_file_result ,
3924+ ancestor : * const git_merge_file_input ,
3925+ ours : * const git_merge_file_input ,
3926+ theirs : * const git_merge_file_input ,
3927+ opts : * const git_merge_file_options ,
3928+ ) -> c_int ;
3929+
3930+ // Not used?
3931+ pub fn git_merge_file_result_free ( result : * mut git_merge_file_result ) ;
3932+ }
3933+
38573934pub fn init ( ) {
38583935 use std:: sync:: Once ;
38593936
0 commit comments