diff --git a/Cargo.toml b/Cargo.toml index c4af9dba02..526e29800a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git2" -version = "0.16.1" +version = "0.17.0" authors = ["Josh Triplett ", "Alex Crichton "] license = "MIT OR Apache-2.0" readme = "README.md" @@ -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 } diff --git a/README.md b/README.md index 1a7842a960..d94ff5a9f1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ libgit2 bindings for Rust. ```toml [dependencies] -git2 = "0.16.1" +git2 = "0.17.0" ``` ## Rust version requirements diff --git a/git2-curl/Cargo.toml b/git2-curl/Cargo.toml index ac906367fc..8e30c69052 100644 --- a/git2-curl/Cargo.toml +++ b/git2-curl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git2-curl" -version = "0.17.0" +version = "0.18.0" authors = ["Josh Triplett ", "Alex Crichton "] license = "MIT OR Apache-2.0" repository = "/~https://github.com/rust-lang/git2-rs" @@ -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" diff --git a/git2-curl/src/lib.rs b/git2-curl/src/lib.rs index c0f0e30d19..a0a6c98719 100644 --- a/git2-curl/src/lib.rs +++ b/git2-curl/src/lib.rs @@ -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))] diff --git a/libgit2-sys/Cargo.toml b/libgit2-sys/Cargo.toml index f4640b9b9a..6f2888b22a 100644 --- a/libgit2-sys/Cargo.toml +++ b/libgit2-sys/Cargo.toml @@ -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 ", "Alex Crichton "] links = "git2" build = "build.rs" diff --git a/libgit2-sys/build.rs b/libgit2-sys/build.rs index 4cd3e1f945..b00c3587e3 100644 --- a/libgit2-sys/build.rs +++ b/libgit2-sys/build.rs @@ -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()); } @@ -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"); diff --git a/libgit2-sys/lib.rs b/libgit2-sys/lib.rs index 26502eccdf..f314ae5da1 100644 --- a/libgit2-sys/lib.rs +++ b/libgit2-sys/lib.rs @@ -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. @@ -1160,37 +1160,40 @@ pub type git_diff_notify_cb = Option< pub type git_diff_progress_cb = Option 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 { @@ -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, diff --git a/libgit2-sys/libgit2 b/libgit2-sys/libgit2 index 42e5db98b9..8a871d13b7 160000 --- a/libgit2-sys/libgit2 +++ b/libgit2-sys/libgit2 @@ -1 +1 @@ -Subproject commit 42e5db98b963ae503229c63e44e06e439df50e56 +Subproject commit 8a871d13b7f4e186b8ad943ae5a7fcf30be52e67 diff --git a/src/diff.rs b/src/diff.rs index 4dc895fa1b..fcc9f5e81f 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -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 { diff --git a/src/lib.rs b/src/lib.rs index 77cb523d15..3671b2859a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] diff --git a/systest/build.rs b/systest/build.rs index eba93f3090..58837ee013 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -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... diff --git a/tests/add_extensions.rs b/tests/add_extensions.rs index fe37e1eeb7..7d80b705db 100644 --- a/tests/add_extensions.rs +++ b/tests/add_extensions.rs @@ -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(()) } diff --git a/tests/get_extensions.rs b/tests/get_extensions.rs index ac049c6816..d8dd55fe0a 100644 --- a/tests/get_extensions.rs +++ b/tests/get_extensions.rs @@ -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(()) } diff --git a/tests/remove_extensions.rs b/tests/remove_extensions.rs index 366da7392b..5f632a8809 100644 --- a/tests/remove_extensions.rs +++ b/tests/remove_extensions.rs @@ -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() }?;