Skip to content

Commit

Permalink
Update to libgit2 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Feb 26, 2023
1 parent d5320a8 commit b117510
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 75 deletions.
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.16.1"
version = "0.17.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.14.2" }
libgit2-sys = { path = "libgit2-sys", version = "0.15.0" }

[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
openssl-sys = { version = "0.9.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion 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.16.1"
git2 = "0.17.0"
```

## Rust version requirements
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.17.0"
version = "0.18.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.16", default-features = false }
git2 = { path = "..", version = "0.17", 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.17")]
#![doc(html_root_url = "https://docs.rs/git2-curl/0.18")]
#![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.14.2+1.5.1"
version = "0.15.0+1.6.1"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
links = "git2"
build = "build.rs"
Expand Down
10 changes: 2 additions & 8 deletions libgit2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +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();
// These version ranges specifically request a version that includes
// the SSH fixes for CVE-2023-22742 (1.5.1+ or 1.4.5+).
if let Ok(lib) = cfg
.range_version("1.5.1".."1.6.0")
.probe("libgit2")
.or_else(|_| cfg.range_version("1.4.5".."1.5.0").probe("libgit2"))
{
if let Ok(lib) = cfg.range_version("1.6.1".."1.7.0").probe("libgit2") {
for include in &lib.include_paths {
println!("cargo:root={}", include.display());
}
Expand Down Expand Up @@ -194,7 +188,7 @@ fn main() {
}

features.push_str("#endif\n");
fs::write(include.join("git2/sys/features.h"), features).unwrap();
fs::write(include.join("git2_features.h"), features).unwrap();

cfg.compile("git2");

Expand Down
76 changes: 35 additions & 41 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.14")]
#![doc(html_root_url = "https://docs.rs/libgit2-sys/0.15")]
#![allow(non_camel_case_types, unused_extern_crates)]

// This is required to link libz when libssh2-sys is not included.
Expand Down Expand Up @@ -1160,37 +1160,40 @@ pub type git_diff_notify_cb = Option<
pub type git_diff_progress_cb =
Option<extern "C" fn(*const git_diff, *const c_char, *const c_char, *mut c_void) -> c_int>;

pub type git_diff_option_t = i32;
pub const GIT_DIFF_NORMAL: git_diff_option_t = 0;
pub const GIT_DIFF_REVERSE: git_diff_option_t = 1 << 0;
pub const GIT_DIFF_INCLUDE_IGNORED: git_diff_option_t = 1 << 1;
pub const GIT_DIFF_RECURSE_IGNORED_DIRS: git_diff_option_t = 1 << 2;
pub const GIT_DIFF_INCLUDE_UNTRACKED: git_diff_option_t = 1 << 3;
pub const GIT_DIFF_RECURSE_UNTRACKED_DIRS: git_diff_option_t = 1 << 4;
pub const GIT_DIFF_INCLUDE_UNMODIFIED: git_diff_option_t = 1 << 5;
pub const GIT_DIFF_INCLUDE_TYPECHANGE: git_diff_option_t = 1 << 6;
pub const GIT_DIFF_INCLUDE_TYPECHANGE_TREES: git_diff_option_t = 1 << 7;
pub const GIT_DIFF_IGNORE_FILEMODE: git_diff_option_t = 1 << 8;
pub const GIT_DIFF_IGNORE_SUBMODULES: git_diff_option_t = 1 << 9;
pub const GIT_DIFF_IGNORE_CASE: git_diff_option_t = 1 << 10;
pub const GIT_DIFF_DISABLE_PATHSPEC_MATCH: git_diff_option_t = 1 << 12;
pub const GIT_DIFF_SKIP_BINARY_CHECK: git_diff_option_t = 1 << 13;
pub const GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS: git_diff_option_t = 1 << 14;
pub const GIT_DIFF_UPDATE_INDEX: git_diff_option_t = 1 << 15;
pub const GIT_DIFF_INCLUDE_UNREADABLE: git_diff_option_t = 1 << 16;
pub const GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED: git_diff_option_t = 1 << 17;
pub const GIT_DIFF_INDENT_HEURISTIC: git_diff_option_t = 1 << 18;
pub const GIT_DIFF_IGNORE_BLANK_LINES: git_diff_option_t = 1 << 19;
pub const GIT_DIFF_FORCE_TEXT: git_diff_option_t = 1 << 20;
pub const GIT_DIFF_FORCE_BINARY: git_diff_option_t = 1 << 21;
pub const GIT_DIFF_IGNORE_WHITESPACE: git_diff_option_t = 1 << 22;
pub const GIT_DIFF_IGNORE_WHITESPACE_CHANGE: git_diff_option_t = 1 << 23;
pub const GIT_DIFF_IGNORE_WHITESPACE_EOL: git_diff_option_t = 1 << 24;
pub const GIT_DIFF_SHOW_UNTRACKED_CONTENT: git_diff_option_t = 1 << 25;
pub const GIT_DIFF_SHOW_UNMODIFIED: git_diff_option_t = 1 << 26;
pub const GIT_DIFF_PATIENCE: git_diff_option_t = 1 << 28;
pub const GIT_DIFF_MINIMAL: git_diff_option_t = 1 << 29;
pub const GIT_DIFF_SHOW_BINARY: git_diff_option_t = 1 << 30;
git_enum! {
pub enum git_diff_option_t {
GIT_DIFF_NORMAL = 0,
GIT_DIFF_REVERSE = 1 << 0,
GIT_DIFF_INCLUDE_IGNORED = 1 << 1,
GIT_DIFF_RECURSE_IGNORED_DIRS = 1 << 2,
GIT_DIFF_INCLUDE_UNTRACKED = 1 << 3,
GIT_DIFF_RECURSE_UNTRACKED_DIRS = 1 << 4,
GIT_DIFF_INCLUDE_UNMODIFIED = 1 << 5,
GIT_DIFF_INCLUDE_TYPECHANGE = 1 << 6,
GIT_DIFF_INCLUDE_TYPECHANGE_TREES = 1 << 7,
GIT_DIFF_IGNORE_FILEMODE = 1 << 8,
GIT_DIFF_IGNORE_SUBMODULES = 1 << 9,
GIT_DIFF_IGNORE_CASE = 1 << 10,
GIT_DIFF_DISABLE_PATHSPEC_MATCH = 1 << 12,
GIT_DIFF_SKIP_BINARY_CHECK = 1 << 13,
GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS = 1 << 14,
GIT_DIFF_UPDATE_INDEX = 1 << 15,
GIT_DIFF_INCLUDE_UNREADABLE = 1 << 16,
GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED = 1 << 17,
GIT_DIFF_INDENT_HEURISTIC = 1 << 18,
GIT_DIFF_IGNORE_BLANK_LINES = 1 << 19,
GIT_DIFF_FORCE_TEXT = 1 << 20,
GIT_DIFF_FORCE_BINARY = 1 << 21,
GIT_DIFF_IGNORE_WHITESPACE = 1 << 22,
GIT_DIFF_IGNORE_WHITESPACE_CHANGE = 1 << 23,
GIT_DIFF_IGNORE_WHITESPACE_EOL = 1 << 24,
GIT_DIFF_SHOW_UNTRACKED_CONTENT = 1 << 25,
GIT_DIFF_SHOW_UNMODIFIED = 1 << 26,
GIT_DIFF_PATIENCE = 1 << 28,
GIT_DIFF_MINIMAL = 1 << 29,
GIT_DIFF_SHOW_BINARY = 1 << 30,
}
}

#[repr(C)]
pub struct git_diff_find_options {
Expand Down Expand Up @@ -3917,15 +3920,6 @@ extern "C" {

pub fn git_odb_add_disk_alternate(odb: *mut git_odb, path: *const c_char) -> c_int;

pub fn git_odb_backend_loose(
out: *mut *mut git_odb_backend,
objects_dir: *const c_char,
compression_level: c_int,
do_fsync: c_int,
dir_mode: c_uint,
file_mode: c_uint,
) -> c_int;

pub fn git_odb_add_alternate(
odb: *mut git_odb,
backend: *mut git_odb_backend,
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/libgit2
Submodule libgit2 updated 514 files
3 changes: 1 addition & 2 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,7 @@ impl DiffOptions {
opts
}

fn flag(&mut self, opt: i32, val: bool) -> &mut DiffOptions {
let opt = opt as u32;
fn flag(&mut self, opt: raw::git_diff_option_t, val: bool) -> &mut DiffOptions {
if val {
self.raw.flags |= opt;
} else {
Expand Down
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.16")]
#![doc(html_root_url = "https://docs.rs/git2/0.17")]
#![allow(trivial_numeric_casts, trivial_casts)]
#![deny(missing_docs)]
#![warn(rust_2018_idioms)]
Expand Down
16 changes: 5 additions & 11 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ fn main() {
// the real name of this field is ref but that is a reserved keyword
(struct_ == "git_worktree_add_options" && f == "reference")
});
cfg.skip_signededness(|s| {
match s {
s if s.ends_with("_cb") => true,
s if s.ends_with("_callback") => true,
"git_push_transfer_progress" | "git_push_negotiation" | "git_packbuilder_progress" => {
true
}
// TODO: fix this on the next major update of libgit2-sys
"git_diff_option_t" => true,
_ => false,
}
cfg.skip_signededness(|s| match s {
s if s.ends_with("_cb") => true,
s if s.ends_with("_callback") => true,
"git_push_transfer_progress" | "git_push_negotiation" | "git_packbuilder_progress" => true,
_ => false,
});

// not entirely sure why this is failing...
Expand Down
6 changes: 4 additions & 2 deletions tests/add_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ fn test_add_extensions() -> Result<(), Error> {

let extensions = unsafe { get_extensions() }?;

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

Ok(())
}
4 changes: 3 additions & 1 deletion tests/get_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ use git2::Error;
fn test_get_extensions() -> Result<(), Error> {
let extensions = unsafe { get_extensions() }?;

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

Ok(())
}
2 changes: 1 addition & 1 deletion tests/remove_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use git2::Error;
#[test]
fn test_remove_extensions() -> Result<(), Error> {
unsafe {
set_extensions(&["custom", "!ignore", "!noop", "other"])?;
set_extensions(&["custom", "!ignore", "!noop", "!objectformat", "other"])?;
}

let extensions = unsafe { get_extensions() }?;
Expand Down

0 comments on commit b117510

Please sign in to comment.