@@ -1306,6 +1306,65 @@ git_enum! {
13061306 }
13071307}
13081308
1309+ #[ repr( C ) ]
1310+ pub struct git_merge_file_options {
1311+ pub version : c_uint ,
1312+
1313+ /// Label for the ancestor file side of the conflict which will be prepended
1314+ /// to labels in diff3-format merge files.
1315+ pub ancestor_label : * const c_char ,
1316+
1317+ /// Label for our file side of the conflict which will be prepended
1318+ /// to labels in merge files.
1319+ pub our_label : * const c_char ,
1320+
1321+ /// Label for their file side of the conflict which will be prepended
1322+ /// to labels in merge files.
1323+ pub their_label : * const c_char ,
1324+
1325+ /// The file to favor in region conflicts.
1326+ pub favor : git_merge_file_favor_t ,
1327+
1328+ /// see `git_merge_file_flag_t`
1329+ pub flags : c_uint ,
1330+ pub marker_size : c_ushort ,
1331+ }
1332+
1333+ #[ repr( C ) ]
1334+ #[ derive( Copy , Clone ) ]
1335+ pub struct git_merge_file_input {
1336+ pub version : c_uint ,
1337+ /// Pointer to the contents of the file.
1338+ pub ptr : * const c_char ,
1339+ /// Size of the contents pointed to in `ptr`.
1340+ pub size : size_t ,
1341+ /// File name of the conflicted file, or `NULL` to not merge the path.
1342+ pub path : * const c_char ,
1343+ /// File mode of the conflicted file, or `0` to not merge the mode.
1344+ pub mode : c_uint ,
1345+ }
1346+
1347+ #[ repr( C ) ]
1348+ #[ derive( Copy , Clone ) ]
1349+ pub struct git_merge_file_result {
1350+ /// True if the output was automerged, false if the output contains
1351+ /// conflict markers.
1352+ pub automergeable : c_uint ,
1353+
1354+ /// The path that the resultant merge file should use, or NULL if a
1355+ /// filename conflict would occur.
1356+ pub path : * const c_char ,
1357+
1358+ /// The mode that the resultant merge file should use.
1359+ pub mode : c_uint ,
1360+
1361+ /// The contents of the merge.
1362+ pub ptr : * const c_char ,
1363+
1364+ /// The length of the merge contents.
1365+ pub len : size_t ,
1366+ }
1367+
13091368pub type git_transport_cb = Option <
13101369 extern "C" fn (
13111370 out : * mut * mut git_transport ,
@@ -3073,7 +3132,6 @@ extern "C" {
30733132 pub fn git_repository_state_cleanup ( repo : * mut git_repository ) -> c_int ;
30743133
30753134 // merge analysis
3076-
30773135 pub fn git_merge_analysis (
30783136 analysis_out : * mut git_merge_analysis_t ,
30793137 pref_out : * mut git_merge_preference_t ,
@@ -3082,6 +3140,22 @@ extern "C" {
30823140 their_heads_len : usize ,
30833141 ) -> c_int ;
30843142
3143+ // For git_merge_file
3144+ pub fn git_merge_file_options_init ( opts : * mut git_merge_file_options , version : c_uint )
3145+ -> c_int ;
3146+ pub fn git_merge_file_input_init ( opts : * mut git_merge_file_input , version : c_uint ) -> c_int ;
3147+
3148+ pub fn git_merge_file (
3149+ out : * mut git_merge_file_result ,
3150+ ancestor : * const git_merge_file_input ,
3151+ ours : * const git_merge_file_input ,
3152+ theirs : * const git_merge_file_input ,
3153+ opts : * const git_merge_file_options ,
3154+ ) -> c_int ;
3155+
3156+ // Not used?
3157+ pub fn git_merge_file_result_free ( result : * mut git_merge_file_result ) ;
3158+
30853159 // notes
30863160 pub fn git_note_author ( note : * const git_note ) -> * const git_signature ;
30873161 pub fn git_note_committer ( note : * const git_note ) -> * const git_signature ;
@@ -3855,82 +3929,6 @@ extern "C" {
38553929 ) -> c_int ;
38563930}
38573931
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-
39343932pub fn init ( ) {
39353933 use std:: sync:: Once ;
39363934
0 commit comments