@@ -23,6 +23,7 @@ pub const GIT_SUBMODULE_UPDATE_OPTIONS_VERSION: c_uint = 1;
23
23
pub const GIT_ODB_BACKEND_VERSION : c_uint = 1 ;
24
24
pub const GIT_REFDB_BACKEND_VERSION : c_uint = 1 ;
25
25
pub const GIT_CHERRYPICK_OPTIONS_VERSION : c_uint = 1 ;
26
+ pub const GIT_APPLY_OPTIONS_VERSION : c_uint = 1 ;
26
27
27
28
macro_rules! git_enum {
28
29
( pub enum $name: ident { $( $variants: tt) * } ) => {
@@ -1728,6 +1729,35 @@ pub struct git_cherrypick_options {
1728
1729
pub checkout_opts : git_checkout_options ,
1729
1730
}
1730
1731
1732
+ pub type git_apply_delta_cb =
1733
+ Option < extern "C" fn ( delta : * const git_diff_delta , payload : * mut c_void ) -> c_int > ;
1734
+
1735
+ pub type git_apply_hunk_cb =
1736
+ Option < extern "C" fn ( hunk : * const git_diff_hunk , payload : * mut c_void ) -> c_int > ;
1737
+
1738
+ git_enum ! {
1739
+ pub enum git_apply_flags_t {
1740
+ GIT_APPLY_CHECK = 1 <<0 ,
1741
+ }
1742
+ }
1743
+
1744
+ #[ repr( C ) ]
1745
+ pub struct git_apply_options {
1746
+ pub version : c_uint ,
1747
+ pub delta_cb : git_apply_delta_cb ,
1748
+ pub hunk_cb : git_apply_hunk_cb ,
1749
+ pub payload : * mut c_void ,
1750
+ pub flags : u32 ,
1751
+ }
1752
+
1753
+ git_enum ! {
1754
+ pub enum git_apply_location_t {
1755
+ GIT_APPLY_LOCATION_WORKDIR = 0 ,
1756
+ GIT_APPLY_LOCATION_INDEX = 1 ,
1757
+ GIT_APPLY_LOCATION_BOTH = 2 ,
1758
+ }
1759
+ }
1760
+
1731
1761
extern "C" {
1732
1762
// threads
1733
1763
pub fn git_libgit2_init ( ) -> c_int ;
@@ -3587,6 +3617,22 @@ extern "C" {
3587
3617
mainline : c_uint ,
3588
3618
merge_options : * const git_merge_options ,
3589
3619
) -> c_int ;
3620
+
3621
+ // apply
3622
+ pub fn git_apply_options_init ( opts : * mut git_apply_options , version : c_uint ) -> c_int ;
3623
+ pub fn git_apply_to_tree (
3624
+ out : * mut * mut git_index ,
3625
+ repo : * mut git_repository ,
3626
+ preimage : * mut git_tree ,
3627
+ diff : * mut git_diff ,
3628
+ options : * const git_apply_options ,
3629
+ ) -> c_int ;
3630
+ pub fn git_apply (
3631
+ repo : * mut git_repository ,
3632
+ diff : * mut git_diff ,
3633
+ location : git_apply_location_t ,
3634
+ options : * const git_apply_options ,
3635
+ ) -> c_int ;
3590
3636
}
3591
3637
3592
3638
pub fn init ( ) {
0 commit comments