Skip to content

Commit

Permalink
libgit2: Account for further API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjmnt4n committed Mar 22, 2024
1 parent 5187c9e commit 368bc86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ git_enum! {
GIT_EOWNER = -36,
GIT_TIMEOUT = -37,
GIT_EUNCHANGED = -38,
GIT_ENOTSUPPORTED = -39,
GIT_EREADONLY = -40,
}
}

Expand Down Expand Up @@ -878,7 +880,8 @@ git_enum! {
GIT_CONFIG_LEVEL_XDG = 3,
GIT_CONFIG_LEVEL_GLOBAL = 4,
GIT_CONFIG_LEVEL_LOCAL = 5,
GIT_CONFIG_LEVEL_APP = 6,
GIT_CONFIG_LEVEL_WORKTREE = 6,
GIT_CONFIG_LEVEL_APP = 7,
GIT_CONFIG_HIGHEST_LEVEL = -1,
}
}
Expand Down Expand Up @@ -1974,6 +1977,7 @@ git_enum! {
pub struct git_worktree_add_options {
pub version: c_uint,
pub lock: c_int,
pub checkout_existing: c_int,
pub reference: *mut git_reference,
pub checkout_options: git_checkout_options,
}
Expand Down
6 changes: 6 additions & 0 deletions src/worktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ impl<'a> WorktreeAddOptions<'a> {
self
}

/// If enabled, this will checkout the existing branch matching the worktree name.
pub fn checkout_existing(&mut self, enabled: bool) -> &mut WorktreeAddOptions<'a> {
self.raw.checkout_existing = enabled as c_int;
self
}

/// reference to use for the new worktree HEAD
pub fn reference(
&mut self,
Expand Down
4 changes: 3 additions & 1 deletion systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ fn main() {
// this field is marked as const which ctest complains about
(struct_ == "git_rebase_operation" && f == "id") ||
// the real name of this field is ref but that is a reserved keyword
(struct_ == "git_worktree_add_options" && f == "reference")
(struct_ == "git_worktree_add_options" && f == "reference") ||
// the `update_flags` field consists of 2 bitfields
(struct_ == "git_fetch_options" && f == "update_flags")
});
cfg.skip_signededness(|s| match s {
s if s.ends_with("_cb") => true,
Expand Down

0 comments on commit 368bc86

Please sign in to comment.