Skip to content

Commit 85030b5

Browse files
committed
bump libgit2 to v1.7.0
* Bump semver incompat versions for all crates. * Update `tests/add_extensions.rs` as libgit2 extentsions are sorted since 1.7. <libgit2/libgit2@e25f9a9> * xdiff was moved to `deps`, so update `build.rs` accordingly. * New libgit2 features `GIT_IO_POLL`/`GIT_IO_SELECT` were added due to Windows schannel support. Update `build.rs` accordingly. * New struct `git_fetch_negotiation` was added for supporting shallow clone. Update relevant functions and structs accordingly.
1 parent d6d3c0b commit 85030b5

File tree

10 files changed

+46
-14
lines changed

10 files changed

+46
-14
lines changed

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "git2"
3-
version = "0.17.2"
3+
version = "0.18.0"
44
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -20,7 +20,7 @@ url = "2.0"
2020
bitflags = "1.1.0"
2121
libc = "0.2"
2222
log = "0.4.8"
23-
libgit2-sys = { path = "libgit2-sys", version = "0.15.2" }
23+
libgit2-sys = { path = "libgit2-sys", version = "0.16.0" }
2424

2525
[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
2626
openssl-sys = { version = "0.9.45", optional = true }

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ stable release as well.
1616

1717
## Version of libgit2
1818

19-
Currently this library requires libgit2 1.6.4 (or newer patch versions). The
19+
Currently this library requires libgit2 1.7.0 (or newer patch versions). The
2020
source for libgit2 is included in the libgit2-sys crate so there's no need to
2121
pre-install the libgit2 library, the libgit2-sys crate will figure that and/or
2222
build that for you.

Diff for: git2-curl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ edition = "2018"
1616
curl = "0.4.33"
1717
url = "2.0"
1818
log = "0.4"
19-
git2 = { path = "..", version = "0.17", default-features = false }
19+
git2 = { path = "..", version = "0.18", default-features = false }
2020

2121
[dev-dependencies]
2222
civet = "0.11"

Diff for: libgit2-sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libgit2-sys"
3-
version = "0.15.2+1.6.4"
3+
version = "0.16.0+1.7.0"
44
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
55
links = "git2"
66
build = "build.rs"

Diff for: libgit2-sys/build.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat;
1515
if try_to_use_system_libgit2 {
1616
let mut cfg = pkg_config::Config::new();
17-
if let Ok(lib) = cfg.range_version("1.6.4".."1.7.0").probe("libgit2") {
17+
if let Ok(lib) = cfg.range_version("1.7.0".."1.8.0").probe("libgit2") {
1818
for include in &lib.include_paths {
1919
println!("cargo:root={}", include.display());
2020
}
@@ -49,7 +49,6 @@ fn main() {
4949
// Include all cross-platform C files
5050
add_c_files(&mut cfg, "libgit2/src/libgit2");
5151
add_c_files(&mut cfg, "libgit2/src/util");
52-
add_c_files(&mut cfg, "libgit2/src/libgit2/xdiff");
5352

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

63+
// external/system xdiff is not yet supported
64+
cfg.include("libgit2/deps/xdiff");
65+
add_c_files(&mut cfg, "libgit2/deps/xdiff");
66+
6467
// Use the included PCRE regex backend.
6568
//
6669
// Ideally these defines would be specific to the pcre files (or placed in
@@ -119,6 +122,14 @@ fn main() {
119122
features.push_str("#define GIT_USE_NSEC 1\n");
120123
}
121124

125+
if windows {
126+
features.push_str("#define GIT_IO_WSAPOLL 1\n");
127+
} else {
128+
// Should we fallback to `select` as more systems have that?
129+
features.push_str("#define GIT_IO_POLL 1\n");
130+
features.push_str("#define GIT_IO_SELECT 1\n");
131+
}
132+
122133
if target.contains("apple") {
123134
features.push_str("#define GIT_USE_STAT_MTIMESPEC 1\n");
124135
} else {

Diff for: libgit2-sys/lib.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,20 @@ pub struct git_fetch_options {
394394
pub update_fetchhead: c_int,
395395
pub download_tags: git_remote_autotag_option_t,
396396
pub proxy_opts: git_proxy_options,
397+
pub depth: c_int,
397398
pub follow_redirects: git_remote_redirect_t,
398399
pub custom_headers: git_strarray,
399400
}
400401

402+
#[repr(C)]
403+
pub struct git_fetch_negotiation {
404+
refs: *const *const git_remote_head,
405+
refs_len: size_t,
406+
shallow_roots: *mut git_oid,
407+
shallow_roots_len: size_t,
408+
depth: c_int,
409+
}
410+
401411
git_enum! {
402412
pub enum git_remote_autotag_option_t {
403413
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
@@ -1137,12 +1147,21 @@ pub struct git_diff_options {
11371147
pub payload: *mut c_void,
11381148
pub context_lines: u32,
11391149
pub interhunk_lines: u32,
1150+
pub oid_type: git_oid_t,
11401151
pub id_abbrev: u16,
11411152
pub max_size: git_off_t,
11421153
pub old_prefix: *const c_char,
11431154
pub new_prefix: *const c_char,
11441155
}
11451156

1157+
git_enum! {
1158+
pub enum git_oid_t {
1159+
GIT_OID_SHA1 = 1,
1160+
// SHA256 is still experimental so we are not going to enable it.
1161+
/* GIT_OID_SHA256 = 2, */
1162+
}
1163+
}
1164+
11461165
git_enum! {
11471166
pub enum git_diff_format_t {
11481167
GIT_DIFF_FORMAT_PATCH = 1,
@@ -1406,10 +1425,11 @@ pub struct git_transport {
14061425
extern "C" fn(
14071426
transport: *mut git_transport,
14081427
repo: *mut git_repository,
1409-
refs: *const *const git_remote_head,
1410-
count: size_t,
1428+
fetch_data: *const git_fetch_negotiation,
14111429
) -> c_int,
14121430
>,
1431+
pub shallow_roots:
1432+
Option<extern "C" fn(out: *mut git_oidarray, transport: *mut git_transport) -> c_int>,
14131433
pub download_pack: Option<
14141434
extern "C" fn(
14151435
transport: *mut git_transport,

Diff for: libgit2-sys/libgit2

Submodule libgit2 updated 358 files

Diff for: src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
//! source `Repository`, to ensure that they do not outlive the repository
6666
//! itself.
6767
68-
#![doc(html_root_url = "https://docs.rs/git2/0.17")]
68+
#![doc(html_root_url = "https://docs.rs/git2/0.18")]
6969
#![allow(trivial_numeric_casts, trivial_casts)]
7070
#![deny(missing_docs)]
7171
#![warn(rust_2018_idioms)]

Diff for: src/remote.rs

+1
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
588588
prune: crate::call::convert(&self.prune),
589589
update_fetchhead: crate::call::convert(&self.update_fetchhead),
590590
download_tags: crate::call::convert(&self.download_tags),
591+
depth: 1, // See `GIT_FETCH_OPTIONS_INIT`.
591592
follow_redirects: self.follow_redirects.raw(),
592593
custom_headers: git_strarray {
593594
count: self.custom_headers_ptrs.len(),

Diff for: tests/add_extensions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ fn test_add_extensions() -> Result<(), Error> {
1212
let extensions = unsafe { get_extensions() }?;
1313

1414
assert_eq!(extensions.len(), 3);
15-
assert_eq!(extensions.get(0), Some("noop"));
15+
assert_eq!(extensions.get(0), Some("custom"));
1616
// The objectformat extension was added in 1.6
17-
assert_eq!(extensions.get(1), Some("objectformat"));
18-
assert_eq!(extensions.get(2), Some("custom"));
17+
assert_eq!(extensions.get(1), Some("noop"));
18+
assert_eq!(extensions.get(2), Some("objectformat"));
1919

2020
Ok(())
2121
}

0 commit comments

Comments
 (0)