@@ -1758,6 +1758,34 @@ git_enum! {
17581758 }
17591759}
17601760
1761+ #[ repr( C ) ]
1762+ pub struct git_worktree_add_options {
1763+ pub version : c_uint ,
1764+ pub lock : c_int ,
1765+ pub reference : * mut git_reference ,
1766+ }
1767+
1768+ pub const GIT_WORKTREE_ADD_OPTIONS_VERSION : u32 = 1 ;
1769+
1770+ git_enum ! {
1771+ pub enum git_worktree_prune_t {
1772+ /* Prune working tree even if working tree is valid */
1773+ GIT_WORKTREE_PRUNE_VALID = 1 << 0 ,
1774+ /* Prune working tree even if it is locked */
1775+ GIT_WORKTREE_PRUNE_LOCKED = 1 << 1 ,
1776+ /* Prune checked out working tree */
1777+ GIT_WORKTREE_PRUNE_WORKING_TREE = 1 << 2 ,
1778+ }
1779+ }
1780+
1781+ #[ repr( C ) ]
1782+ pub struct git_worktree_prune_options {
1783+ pub version : c_uint ,
1784+ pub flags : u32 ,
1785+ }
1786+
1787+ pub const GIT_WORKTREE_PRUNE_OPTIONS_VERSION : u32 = 1 ;
1788+
17611789extern "C" {
17621790 // threads
17631791 pub fn git_libgit2_init ( ) -> c_int ;
@@ -3645,6 +3673,48 @@ extern "C" {
36453673 location : git_apply_location_t ,
36463674 options : * const git_apply_options ,
36473675 ) -> c_int ;
3676+
3677+ // Worktrees
3678+ pub fn git_worktree_list ( out : * mut git_strarray , repo : * mut git_repository ) -> c_int ;
3679+ pub fn git_worktree_lookup (
3680+ out : * mut * mut git_worktree ,
3681+ repo : * mut git_repository ,
3682+ name : * const c_char ,
3683+ ) -> c_int ;
3684+ pub fn git_worktree_open_from_repository (
3685+ out : * mut * mut git_worktree ,
3686+ repo : * mut git_repository ,
3687+ ) -> c_int ;
3688+ pub fn git_worktree_free ( wt : * mut git_worktree ) ;
3689+ pub fn git_worktree_validate ( wt : * const git_worktree ) -> c_int ;
3690+ pub fn git_worktree_add_options_init (
3691+ opts : * mut git_worktree_add_options ,
3692+ version : c_uint ,
3693+ ) -> c_int ;
3694+ pub fn git_worktree_add (
3695+ out : * mut * mut git_worktree ,
3696+ repo : * mut git_repository ,
3697+ name : * const c_char ,
3698+ path : * const c_char ,
3699+ opts : * const git_worktree_add_options ,
3700+ ) -> c_int ;
3701+ pub fn git_worktree_lock ( wt : * mut git_worktree , reason : * const c_char ) -> c_int ;
3702+ pub fn git_worktree_unlock ( wt : * mut git_worktree ) -> c_int ;
3703+ pub fn git_worktree_is_locked ( reason : * mut git_buf , wt : * const git_worktree ) -> c_int ;
3704+ pub fn git_worktree_name ( wt : * const git_worktree ) -> * const c_char ;
3705+ pub fn git_worktree_path ( wt : * const git_worktree ) -> * const c_char ;
3706+ pub fn git_worktree_prune_options_init (
3707+ opts : * mut git_worktree_prune_options ,
3708+ version : c_uint ,
3709+ ) -> c_int ;
3710+ pub fn git_worktree_is_prunable (
3711+ wt : * mut git_worktree ,
3712+ opts : * mut git_worktree_prune_options ,
3713+ ) -> c_int ;
3714+ pub fn git_worktree_prune (
3715+ wt : * mut git_worktree ,
3716+ opts : * mut git_worktree_prune_options ,
3717+ ) -> c_int ;
36483718}
36493719
36503720pub fn init ( ) {
0 commit comments