Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libgit2 to 1.9 #1111

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git2"
version = "0.19.0"
version = "0.20.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand All @@ -20,7 +20,7 @@ url = "2.0"
bitflags = "2.1.0"
libc = "0.2"
log = "0.4.8"
libgit2-sys = { path = "libgit2-sys", version = "0.17.0" }
libgit2-sys = { path = "libgit2-sys", version = "0.18.0" }

[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
openssl-sys = { version = "0.9.45", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ libgit2 bindings for Rust.

```toml
[dependencies]
git2 = "0.19.0"
git2 = "0.20.0"
```

## Rust version requirements
Expand All @@ -16,7 +16,7 @@ stable release as well.

## Version of libgit2

Currently this library requires libgit2 1.8.1 (or newer patch versions). The
Currently this library requires libgit2 1.9.0 (or newer patch versions). The
source for libgit2 is included in the libgit2-sys crate so there's no need to
pre-install the libgit2 library, the libgit2-sys crate will figure that and/or
build that for you. On the other hand, if an appropriate version of `libgit2`
Expand Down
4 changes: 2 additions & 2 deletions git2-curl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git2-curl"
version = "0.20.0"
version = "0.21.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/git2-rs"
Expand All @@ -16,7 +16,7 @@ edition = "2018"
curl = "0.4.33"
url = "2.0"
log = "0.4"
git2 = { path = "..", version = "0.19", default-features = false }
git2 = { path = "..", version = "0.20", default-features = false }

[dev-dependencies]
civet = "0.11"
Expand Down
2 changes: 1 addition & 1 deletion git2-curl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! > **NOTE**: At this time this crate likely does not support a `git push`
//! > operation, only clones.
#![doc(html_root_url = "https://docs.rs/git2-curl/0.20")]
#![doc(html_root_url = "https://docs.rs/git2-curl/0.21")]
#![deny(missing_docs)]
#![warn(rust_2018_idioms)]
#![cfg_attr(test, deny(warnings))]
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libgit2-sys"
version = "0.17.0+1.8.1"
version = "0.18.0+1.9.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
links = "git2"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::process::Command;
/// Tries to use system libgit2 and emits necessary build script instructions.
fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
let mut cfg = pkg_config::Config::new();
match cfg.range_version("1.8.1".."1.9.0").probe("libgit2") {
match cfg.range_version("1.9.0".."1.10.0").probe("libgit2") {
Ok(lib) => {
for include in &lib.include_paths {
println!("cargo:root={}", include.display());
Expand Down
23 changes: 17 additions & 6 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url = "https://docs.rs/libgit2-sys/0.17")]
#![doc(html_root_url = "https://docs.rs/libgit2-sys/0.18")]
#![allow(non_camel_case_types, unused_extern_crates)]

// This is required to link libz when libssh2-sys is not included.
Expand Down Expand Up @@ -395,6 +395,15 @@ pub struct git_remote_callbacks {
pub remote_ready: git_remote_ready_cb,
pub payload: *mut c_void,
pub resolve_url: git_url_resolve_cb,
pub update_refs: Option<
extern "C" fn(
*const c_char,
*const git_oid,
*const git_oid,
*mut git_refspec,
*mut c_void,
) -> c_int,
>,
}

#[repr(C)]
Expand Down Expand Up @@ -668,8 +677,7 @@ pub struct git_status_entry {

git_enum! {
pub enum git_checkout_strategy_t {
GIT_CHECKOUT_NONE = 0,
GIT_CHECKOUT_SAFE = 1 << 0,
GIT_CHECKOUT_SAFE = 0,
GIT_CHECKOUT_FORCE = 1 << 1,
GIT_CHECKOUT_RECREATE_MISSING = 1 << 2,
GIT_CHECKOUT_ALLOW_CONFLICTS = 1 << 4,
Expand All @@ -686,6 +694,7 @@ git_enum! {
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED = 1 << 19,
GIT_CHECKOUT_CONFLICT_STYLE_MERGE = 1 << 20,
GIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = 1 << 21,
GIT_CHECKOUT_NONE = 1 << 30,

GIT_CHECKOUT_UPDATE_SUBMODULES = 1 << 16,
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = 1 << 17,
Expand Down Expand Up @@ -808,10 +817,13 @@ pub struct git_blame_hunk {
pub final_commit_id: git_oid,
pub final_start_line_number: usize,
pub final_signature: *mut git_signature,
pub final_committer: *mut git_signature,
pub orig_commit_id: git_oid,
pub orig_path: *const c_char,
pub orig_start_line_number: usize,
pub orig_signature: *mut git_signature,
pub orig_committer: *mut git_signature,
pub summary: *const c_char,
pub boundary: c_char,
}

Expand Down Expand Up @@ -870,7 +882,6 @@ pub struct git_config_entry {
pub origin_path: *const c_char,
pub include_depth: c_uint,
pub level: git_config_level_t,
pub free: Option<extern "C" fn(*mut git_config_entry)>,
}

git_enum! {
Expand Down Expand Up @@ -2906,7 +2917,7 @@ extern "C" {
message: *const c_char,
tree: *const git_tree,
parent_count: size_t,
parents: *const *mut git_commit,
parents: *mut *const git_commit,
) -> c_int;
pub fn git_commit_create_buffer(
out: *mut git_buf,
Expand All @@ -2917,7 +2928,7 @@ extern "C" {
message: *const c_char,
tree: *const git_tree,
parent_count: size_t,
parents: *const *mut git_commit,
parents: *mut *const git_commit,
) -> c_int;
pub fn git_commit_header_field(
out: *mut git_buf,
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/libgit2
Submodule libgit2 updated 423 files
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
//! source `Repository`, to ensure that they do not outlive the repository
//! itself.

#![doc(html_root_url = "https://docs.rs/git2/0.19")]
#![doc(html_root_url = "https://docs.rs/git2/0.20")]
#![allow(trivial_numeric_casts, trivial_casts)]
#![deny(missing_docs)]
#![warn(rust_2018_idioms)]
Expand Down
12 changes: 6 additions & 6 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,9 @@ impl Repository {
parents: &[&Commit<'_>],
) -> Result<Oid, Error> {
let update_ref = crate::opt_cstr(update_ref)?;
let parent_ptrs = parents
let mut parent_ptrs = parents
.iter()
.map(|p| p.raw() as *mut raw::git_commit)
.map(|p| p.raw() as *const raw::git_commit)
.collect::<Vec<_>>();
let message = CString::new(message)?;
let mut raw = raw::git_oid {
Expand All @@ -1321,7 +1321,7 @@ impl Repository {
message,
tree.raw(),
parents.len() as size_t,
parent_ptrs.as_ptr()
parent_ptrs.as_mut_ptr()
));
Ok(Binding::from_raw(&raw as *const _))
}
Expand All @@ -1340,9 +1340,9 @@ impl Repository {
tree: &Tree<'_>,
parents: &[&Commit<'_>],
) -> Result<Buf, Error> {
let parent_ptrs = parents
let mut parent_ptrs = parents
.iter()
.map(|p| p.raw() as *mut raw::git_commit)
.map(|p| p.raw() as *const raw::git_commit)
.collect::<Vec<_>>();
let message = CString::new(message)?;
let buf = Buf::new();
Expand All @@ -1356,7 +1356,7 @@ impl Repository {
message,
tree.raw(),
parents.len() as size_t,
parent_ptrs.as_ptr()
parent_ptrs.as_mut_ptr()
));
Ok(buf)
}
Expand Down
1 change: 1 addition & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn main() {
.header("git2/sys/mempack.h")
.header("git2/sys/repository.h")
.header("git2/sys/cred.h")
.header("git2/sys/email.h")
.header("git2/cred_helpers.h")
.type_name(|s, _, _| s.to_string());
cfg.field_name(|_, f| match f {
Expand Down
21 changes: 14 additions & 7 deletions tests/add_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ fn test_add_extensions() -> Result<(), Error> {
}

let extensions = unsafe { get_extensions() }?;
let extensions: Vec<_> = extensions.iter().collect();

assert_eq!(extensions.len(), 4);
assert_eq!(extensions.get(0), Some("custom"));
assert_eq!(extensions.get(1), Some("noop"));
// The objectformat extension was added in 1.6
assert_eq!(extensions.get(2), Some("objectformat"));
// The worktreeconfig extension was added in 1.8
assert_eq!(extensions.get(3), Some("worktreeconfig"));
assert_eq!(
extensions,
[
Some("custom"),
Some("noop"),
// The objectformat extension was added in 1.6
Some("objectformat"),
// The preciousobjects extension was added in 1.9
Some("preciousobjects"),
// The worktreeconfig extension was added in 1.8
Some("worktreeconfig")
]
);

Ok(())
}
19 changes: 13 additions & 6 deletions tests/get_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ use git2::Error;
#[test]
fn test_get_extensions() -> Result<(), Error> {
let extensions = unsafe { get_extensions() }?;
let extensions: Vec<_> = extensions.iter().collect();

assert_eq!(extensions.len(), 3);
assert_eq!(extensions.get(0), Some("noop"));
// The objectformat extension was added in 1.6
assert_eq!(extensions.get(1), Some("objectformat"));
// The worktreeconfig extension was added in 1.8
assert_eq!(extensions.get(2), Some("worktreeconfig"));
assert_eq!(
extensions,
[
Some("noop"),
// The objectformat extension was added in 1.6
Some("objectformat"),
// The preciousobjects extension was added in 1.9
Some("preciousobjects"),
// The worktreeconfig extension was added in 1.8
Some("worktreeconfig")
]
);

Ok(())
}
6 changes: 3 additions & 3 deletions tests/remove_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ fn test_remove_extensions() -> Result<(), Error> {
"!ignore",
"!noop",
"!objectformat",
"!preciousobjects",
"!worktreeconfig",
"other",
])?;
}

let extensions = unsafe { get_extensions() }?;
let extensions: Vec<_> = extensions.iter().collect();

assert_eq!(extensions.len(), 2);
assert_eq!(extensions.get(0), Some("custom"));
assert_eq!(extensions.get(1), Some("other"));
assert_eq!(extensions, [Some("custom"), Some("other")]);

Ok(())
}
Loading