@@ -1825,6 +1825,34 @@ git_enum! {
18251825 }
18261826}
18271827
1828+ #[repr(C)]
1829+ pub struct git_worktree_add_options {
1830+ pub version: c_uint,
1831+ pub lock: c_int,
1832+ pub reference: *mut git_reference,
1833+ }
1834+
1835+ pub const GIT_WORKTREE_ADD_OPTIONS_VERSION: c_uint = 1;
1836+
1837+ git_enum! {
1838+ pub enum git_worktree_prune_t {
1839+ /* Prune working tree even if working tree is valid */
1840+ GIT_WORKTREE_PRUNE_VALID = 1 << 0,
1841+ /* Prune working tree even if it is locked */
1842+ GIT_WORKTREE_PRUNE_LOCKED = 1 << 1,
1843+ /* Prune checked out working tree */
1844+ GIT_WORKTREE_PRUNE_WORKING_TREE = 1 << 2,
1845+ }
1846+ }
1847+
1848+ #[repr(C)]
1849+ pub struct git_worktree_prune_options {
1850+ pub version: c_uint,
1851+ pub flags: u32,
1852+ }
1853+
1854+ pub const GIT_WORKTREE_PRUNE_OPTIONS_VERSION: c_uint = 1;
1855+
18281856extern "C" {
18291857 // threads
18301858 pub fn git_libgit2_init() -> c_int;
@@ -3782,6 +3810,48 @@ extern "C" {
37823810 ) -> c_int;
37833811
37843812 pub fn git_libgit2_opts(option: c_int, ...) -> c_int;
3813+
3814+ // Worktrees
3815+ pub fn git_worktree_list(out: *mut git_strarray, repo: *mut git_repository) -> c_int;
3816+ pub fn git_worktree_lookup(
3817+ out: *mut *mut git_worktree,
3818+ repo: *mut git_repository,
3819+ name: *const c_char,
3820+ ) -> c_int;
3821+ pub fn git_worktree_open_from_repository(
3822+ out: *mut *mut git_worktree,
3823+ repo: *mut git_repository,
3824+ ) -> c_int;
3825+ pub fn git_worktree_free(wt: *mut git_worktree);
3826+ pub fn git_worktree_validate(wt: *const git_worktree) -> c_int;
3827+ pub fn git_worktree_add_options_init(
3828+ opts: *mut git_worktree_add_options,
3829+ version: c_uint,
3830+ ) -> c_int;
3831+ pub fn git_worktree_add(
3832+ out: *mut *mut git_worktree,
3833+ repo: *mut git_repository,
3834+ name: *const c_char,
3835+ path: *const c_char,
3836+ opts: *const git_worktree_add_options,
3837+ ) -> c_int;
3838+ pub fn git_worktree_lock(wt: *mut git_worktree, reason: *const c_char) -> c_int;
3839+ pub fn git_worktree_unlock(wt: *mut git_worktree) -> c_int;
3840+ pub fn git_worktree_is_locked(reason: *mut git_buf, wt: *const git_worktree) -> c_int;
3841+ pub fn git_worktree_name(wt: *const git_worktree) -> *const c_char;
3842+ pub fn git_worktree_path(wt: *const git_worktree) -> *const c_char;
3843+ pub fn git_worktree_prune_options_init(
3844+ opts: *mut git_worktree_prune_options,
3845+ version: c_uint,
3846+ ) -> c_int;
3847+ pub fn git_worktree_is_prunable(
3848+ wt: *mut git_worktree,
3849+ opts: *mut git_worktree_prune_options,
3850+ ) -> c_int;
3851+ pub fn git_worktree_prune(
3852+ wt: *mut git_worktree,
3853+ opts: *mut git_worktree_prune_options,
3854+ ) -> c_int;
37853855}
37863856
37873857pub fn init() {
0 commit comments