Skip to content

Commit c074cab

Browse files
committed
worktree: Update struct representation for git_worktree_add_options
1 parent 8b5fba7 commit c074cab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

libgit2-sys/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,7 @@ git_enum! {
19771977
pub struct git_worktree_add_options {
19781978
pub version: c_uint,
19791979
pub lock: c_int,
1980+
pub checkout_existing: c_int,
19801981
pub reference: *mut git_reference,
19811982
pub checkout_options: git_checkout_options,
19821983
}

src/worktree.rs

+6
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ impl<'a> WorktreeAddOptions<'a> {
165165
self
166166
}
167167

168+
/// If enabled, this will checkout the existing branch matching the worktree name.
169+
pub fn checkout_existing(&mut self, enabled: bool) -> &mut WorktreeAddOptions<'a> {
170+
self.raw.checkout_existing = enabled as c_int;
171+
self
172+
}
173+
168174
/// reference to use for the new worktree HEAD
169175
pub fn reference(
170176
&mut self,

0 commit comments

Comments
 (0)