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

bump libgit2 to v1.7.0 #968

Merged
merged 7 commits into from
Jul 25, 2023
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.17.2"
version = "0.18.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 = "1.1.0"
libc = "0.2"
log = "0.4.8"
libgit2-sys = { path = "libgit2-sys", version = "0.15.2" }
libgit2-sys = { path = "libgit2-sys", version = "0.16.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.17.2"
git2 = "0.18.0"
```

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

## Version of libgit2

Currently this library requires libgit2 1.6.4 (or newer patch versions). The
Currently this library requires libgit2 1.7.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.
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.18.0"
version = "0.19.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.17", default-features = false }
git2 = { path = "..", version = "0.18", default-features = false }
weihanglo marked this conversation as resolved.
Show resolved Hide resolved

[dev-dependencies]
civet = "0.11"
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.15.2+1.6.4"
version = "0.16.0+1.7.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
links = "git2"
build = "build.rs"
Expand Down
16 changes: 14 additions & 2 deletions libgit2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() {
let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
if try_to_use_system_libgit2 {
let mut cfg = pkg_config::Config::new();
if let Ok(lib) = cfg.range_version("1.6.4".."1.7.0").probe("libgit2") {
if let Ok(lib) = cfg.range_version("1.7.0".."1.8.0").probe("libgit2") {
for include in &lib.include_paths {
println!("cargo:root={}", include.display());
}
Expand Down Expand Up @@ -49,7 +49,6 @@ fn main() {
// Include all cross-platform C files
add_c_files(&mut cfg, "libgit2/src/libgit2");
add_c_files(&mut cfg, "libgit2/src/util");
add_c_files(&mut cfg, "libgit2/src/libgit2/xdiff");

// These are activated by features, but they're all unconditionally always
// compiled apparently and have internal #define's to make sure they're
Expand All @@ -61,6 +60,10 @@ fn main() {
cfg.include("libgit2/deps/http-parser")
.file("libgit2/deps/http-parser/http_parser.c");

// external/system xdiff is not yet supported
cfg.include("libgit2/deps/xdiff");
add_c_files(&mut cfg, "libgit2/deps/xdiff");

// Use the included PCRE regex backend.
//
// Ideally these defines would be specific to the pcre files (or placed in
Expand Down Expand Up @@ -119,6 +122,14 @@ fn main() {
features.push_str("#define GIT_USE_NSEC 1\n");
}

if windows {
features.push_str("#define GIT_IO_WSAPOLL 1\n");
} else {
// Should we fallback to `select` as more systems have that?
features.push_str("#define GIT_IO_POLL 1\n");
features.push_str("#define GIT_IO_SELECT 1\n");
}

if target.contains("apple") {
features.push_str("#define GIT_USE_STAT_MTIMESPEC 1\n");
} else {
Expand Down Expand Up @@ -199,6 +210,7 @@ fn main() {
println!("cargo:rustc-link-lib=rpcrt4");
println!("cargo:rustc-link-lib=ole32");
println!("cargo:rustc-link-lib=crypt32");
println!("cargo:rustc-link-lib=secur32");
}

if target.contains("apple") {
Expand Down
24 changes: 22 additions & 2 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,20 @@ pub struct git_fetch_options {
pub update_fetchhead: c_int,
pub download_tags: git_remote_autotag_option_t,
pub proxy_opts: git_proxy_options,
pub depth: c_int,
pub follow_redirects: git_remote_redirect_t,
pub custom_headers: git_strarray,
}

#[repr(C)]
pub struct git_fetch_negotiation {
refs: *const *const git_remote_head,
refs_len: size_t,
shallow_roots: *mut git_oid,
shallow_roots_len: size_t,
depth: c_int,
}

git_enum! {
pub enum git_remote_autotag_option_t {
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
Expand Down Expand Up @@ -1137,12 +1147,21 @@ pub struct git_diff_options {
pub payload: *mut c_void,
pub context_lines: u32,
pub interhunk_lines: u32,
pub oid_type: git_oid_t,
pub id_abbrev: u16,
pub max_size: git_off_t,
pub old_prefix: *const c_char,
pub new_prefix: *const c_char,
}

git_enum! {
pub enum git_oid_t {
GIT_OID_SHA1 = 1,
// SHA256 is still experimental so we are not going to enable it.
/* GIT_OID_SHA256 = 2, */
}
}

git_enum! {
pub enum git_diff_format_t {
GIT_DIFF_FORMAT_PATCH = 1,
Expand Down Expand Up @@ -1406,10 +1425,11 @@ pub struct git_transport {
extern "C" fn(
transport: *mut git_transport,
repo: *mut git_repository,
refs: *const *const git_remote_head,
count: size_t,
fetch_data: *const git_fetch_negotiation,
) -> c_int,
>,
pub shallow_roots:
Option<extern "C" fn(out: *mut git_oidarray, transport: *mut git_transport) -> c_int>,
pub download_pack: Option<
extern "C" fn(
transport: *mut git_transport,
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/libgit2
Submodule libgit2 updated 358 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.17")]
#![doc(html_root_url = "https://docs.rs/git2/0.18")]
#![allow(trivial_numeric_casts, trivial_casts)]
#![deny(missing_docs)]
#![warn(rust_2018_idioms)]
Expand Down
1 change: 1 addition & 0 deletions src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
prune: crate::call::convert(&self.prune),
update_fetchhead: crate::call::convert(&self.update_fetchhead),
download_tags: crate::call::convert(&self.download_tags),
depth: 0, // GIT_FETCH_DEPTH_FULL.
follow_redirects: self.follow_redirects.raw(),
custom_headers: git_strarray {
count: self.custom_headers_ptrs.len(),
Expand Down
6 changes: 3 additions & 3 deletions tests/add_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ fn test_add_extensions() -> Result<(), Error> {
let extensions = unsafe { get_extensions() }?;

assert_eq!(extensions.len(), 3);
assert_eq!(extensions.get(0), Some("noop"));
assert_eq!(extensions.get(0), Some("custom"));
// The objectformat extension was added in 1.6
assert_eq!(extensions.get(1), Some("objectformat"));
assert_eq!(extensions.get(2), Some("custom"));
assert_eq!(extensions.get(1), Some("noop"));
assert_eq!(extensions.get(2), Some("objectformat"));

Ok(())
}