Skip to content

Commit 324f421

Browse files
authored
Merge pull request #1032 from bnjmnt4n/libgit2-v1.8.0
libgit2: Bump to v1.8.1
2 parents 949aa49 + 76ecfe7 commit 324f421

18 files changed

+148
-38
lines changed

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The following steps can be used to update libgit2:
3131
can be helpful for seeing what has changed.
3232
The project has recently started labeling API and ABI breaking changes with labels:
3333
<https://github.com/libgit2/libgit2/pulls?q=is%3Apr+label%3A%22api+breaking%22%2C%22abi+breaking%22+is%3Aclosed>
34+
Alternatively, running `git diff [PREV_VERSION]..[NEW_VERSION] --ignore-all-space -- include/` can provide an overview of changes made to the API.
3435
4. Once you have everything functional, publish a PR with the updates.
3536

3637
## Release process

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ url = "2.0"
2020
bitflags = "2.1.0"
2121
libc = "0.2"
2222
log = "0.4.8"
23-
libgit2-sys = { path = "libgit2-sys", version = "0.16.2" }
23+
libgit2-sys = { path = "libgit2-sys", version = "0.17.0" }
2424

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

examples/fetch.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![deny(warnings)]
1616

1717
use clap::Parser;
18-
use git2::{AutotagOption, FetchOptions, RemoteCallbacks, Repository};
18+
use git2::{AutotagOption, FetchOptions, RemoteCallbacks, RemoteUpdateFlags, Repository};
1919
use std::io::{self, Write};
2020
use std::str;
2121

@@ -113,7 +113,12 @@ fn run(args: &Args) -> Result<(), git2::Error> {
113113
// commits. This may be needed even if there was no packfile to download,
114114
// which can happen e.g. when the branches have been changed but all the
115115
// needed objects are available locally.
116-
remote.update_tips(None, true, AutotagOption::Unspecified, None)?;
116+
remote.update_tips(
117+
None,
118+
RemoteUpdateFlags::UPDATE_FETCHHEAD,
119+
AutotagOption::Unspecified,
120+
None,
121+
)?;
117122

118123
Ok(())
119124
}

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.16.2+1.7.2"
3+
version = "0.17.0+1.8.1"
44
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
55
links = "git2"
66
build = "build.rs"

libgit2-sys/build.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::process::Command;
77
/// Tries to use system libgit2 and emits necessary build script instructions.
88
fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
99
let mut cfg = pkg_config::Config::new();
10-
match cfg.range_version("1.7.2".."1.8.0").probe("libgit2") {
10+
match cfg.range_version("1.8.1".."1.9.0").probe("libgit2") {
1111
Ok(lib) => {
1212
for include in &lib.include_paths {
1313
println!("cargo:root={}", include.display());
@@ -89,9 +89,9 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
8989
add_c_files(&mut cfg, "libgit2/src/libgit2/transports");
9090
add_c_files(&mut cfg, "libgit2/src/libgit2/streams");
9191

92-
// Always use bundled http-parser for now
93-
cfg.include("libgit2/deps/http-parser")
94-
.file("libgit2/deps/http-parser/http_parser.c");
92+
// Always use bundled HTTP parser (llhttp) for now
93+
cfg.include("libgit2/deps/llhttp");
94+
add_c_files(&mut cfg, "libgit2/deps/llhttp");
9595

9696
// external/system xdiff is not yet supported
9797
cfg.include("libgit2/deps/xdiff");
@@ -150,6 +150,7 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
150150
features.push_str("#define INCLUDE_features_h\n");
151151
features.push_str("#define GIT_THREADS 1\n");
152152
features.push_str("#define GIT_TRACE 1\n");
153+
features.push_str("#define GIT_HTTPPARSER_BUILTIN 1\n");
153154

154155
if !target.contains("android") {
155156
features.push_str("#define GIT_USE_NSEC 1\n");
@@ -180,7 +181,8 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
180181
cfg.include(path);
181182
}
182183
features.push_str("#define GIT_SSH 1\n");
183-
features.push_str("#define GIT_SSH_MEMORY_CREDENTIALS 1\n");
184+
features.push_str("#define GIT_SSH_LIBSSH2 1\n");
185+
features.push_str("#define GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1\n");
184186
}
185187
if https {
186188
features.push_str("#define GIT_HTTPS 1\n");

libgit2-sys/lib.rs

+29-6
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ git_enum! {
198198
GIT_EINDEXDIRTY = -34,
199199
GIT_EAPPLYFAIL = -35,
200200
GIT_EOWNER = -36,
201+
GIT_TIMEOUT = -37,
202+
GIT_EUNCHANGED = -38,
203+
GIT_ENOTSUPPORTED = -39,
204+
GIT_EREADONLY = -40,
201205
}
202206
}
203207

@@ -366,6 +370,13 @@ pub struct git_indexer_options {
366370

367371
pub type git_remote_ready_cb = Option<extern "C" fn(*mut git_remote, c_int, *mut c_void) -> c_int>;
368372

373+
git_enum! {
374+
pub enum git_remote_update_flags {
375+
GIT_REMOTE_UPDATE_FETCHHEAD = 1 << 0,
376+
GIT_REMOTE_UPDATE_REPORT_UNCHANGED = 1 << 1,
377+
}
378+
}
379+
369380
#[repr(C)]
370381
pub struct git_remote_callbacks {
371382
pub version: c_uint,
@@ -391,7 +402,7 @@ pub struct git_fetch_options {
391402
pub version: c_int,
392403
pub callbacks: git_remote_callbacks,
393404
pub prune: git_fetch_prune_t,
394-
pub update_fetchhead: c_int,
405+
pub update_fetchhead: c_uint,
395406
pub download_tags: git_remote_autotag_option_t,
396407
pub proxy_opts: git_proxy_options,
397408
pub depth: c_int,
@@ -855,10 +866,11 @@ pub struct git_index_time {
855866
pub struct git_config_entry {
856867
pub name: *const c_char,
857868
pub value: *const c_char,
869+
pub backend_type: *const c_char,
870+
pub origin_path: *const c_char,
858871
pub include_depth: c_uint,
859872
pub level: git_config_level_t,
860873
pub free: Option<extern "C" fn(*mut git_config_entry)>,
861-
pub payload: *mut c_void,
862874
}
863875

864876
git_enum! {
@@ -868,7 +880,8 @@ git_enum! {
868880
GIT_CONFIG_LEVEL_XDG = 3,
869881
GIT_CONFIG_LEVEL_GLOBAL = 4,
870882
GIT_CONFIG_LEVEL_LOCAL = 5,
871-
GIT_CONFIG_LEVEL_APP = 6,
883+
GIT_CONFIG_LEVEL_WORKTREE = 6,
884+
GIT_CONFIG_LEVEL_APP = 7,
872885
GIT_CONFIG_HIGHEST_LEVEL = -1,
873886
}
874887
}
@@ -981,6 +994,7 @@ pub struct git_push_options {
981994
pub proxy_opts: git_proxy_options,
982995
pub follow_redirects: git_remote_redirect_t,
983996
pub custom_headers: git_strarray,
997+
pub remote_push_options: git_strarray,
984998
}
985999

9861000
pub type git_tag_foreach_cb =
@@ -1947,6 +1961,14 @@ git_enum! {
19471961
GIT_OPT_SET_EXTENSIONS,
19481962
GIT_OPT_GET_OWNER_VALIDATION,
19491963
GIT_OPT_SET_OWNER_VALIDATION,
1964+
GIT_OPT_GET_HOMEDIR,
1965+
GIT_OPT_SET_HOMEDIR,
1966+
GIT_OPT_SET_SERVER_CONNECT_TIMEOUT,
1967+
GIT_OPT_GET_SERVER_CONNECT_TIMEOUT,
1968+
GIT_OPT_SET_SERVER_TIMEOUT,
1969+
GIT_OPT_GET_SERVER_TIMEOUT,
1970+
GIT_OPT_SET_USER_AGENT_PRODUCT,
1971+
GIT_OPT_GET_USER_AGENT_PRODUCT,
19501972
}
19511973
}
19521974

@@ -1963,6 +1985,7 @@ git_enum! {
19631985
pub struct git_worktree_add_options {
19641986
pub version: c_uint,
19651987
pub lock: c_int,
1988+
pub checkout_existing: c_int,
19661989
pub reference: *mut git_reference,
19671990
pub checkout_options: git_checkout_options,
19681991
}
@@ -2326,7 +2349,7 @@ extern "C" {
23262349
pub fn git_remote_update_tips(
23272350
remote: *mut git_remote,
23282351
callbacks: *const git_remote_callbacks,
2329-
update_fetchead: c_int,
2352+
update_flags: c_uint,
23302353
download_tags: git_remote_autotag_option_t,
23312354
reflog_message: *const c_char,
23322355
) -> c_int;
@@ -2882,7 +2905,7 @@ extern "C" {
28822905
message: *const c_char,
28832906
tree: *const git_tree,
28842907
parent_count: size_t,
2885-
parents: *mut *const git_commit,
2908+
parents: *const *mut git_commit,
28862909
) -> c_int;
28872910
pub fn git_commit_create_buffer(
28882911
out: *mut git_buf,
@@ -2893,7 +2916,7 @@ extern "C" {
28932916
message: *const c_char,
28942917
tree: *const git_tree,
28952918
parent_count: size_t,
2896-
parents: *mut *const git_commit,
2919+
parents: *const *mut git_commit,
28972920
) -> c_int;
28982921
pub fn git_commit_header_field(
28992922
out: *mut git_buf,

libgit2-sys/libgit2

Submodule libgit2 updated 342 files

src/call.rs

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ mod impls {
166166
ConfigLevel::XDG => raw::GIT_CONFIG_LEVEL_XDG,
167167
ConfigLevel::Global => raw::GIT_CONFIG_LEVEL_GLOBAL,
168168
ConfigLevel::Local => raw::GIT_CONFIG_LEVEL_LOCAL,
169+
ConfigLevel::Worktree => raw::GIT_CONFIG_LEVEL_WORKTREE,
169170
ConfigLevel::App => raw::GIT_CONFIG_LEVEL_APP,
170171
ConfigLevel::Highest => raw::GIT_CONFIG_HIGHEST_LEVEL,
171172
}

src/cred.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ mod test {
482482
macro_rules! test_cfg( ($($k:expr => $v:expr),*) => ({
483483
let td = TempDir::new().unwrap();
484484
let mut cfg = Config::new().unwrap();
485-
cfg.add_file(&td.path().join("cfg"), ConfigLevel::Highest, false).unwrap();
485+
cfg.add_file(&td.path().join("cfg"), ConfigLevel::App, false).unwrap();
486486
$(cfg.set_str($k, $v).unwrap();)*
487487
cfg
488488
}) );

src/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ pub enum ConfigLevel {
385385
Global,
386386
/// Repository specific config, e.g. $PWD/.git/config
387387
Local,
388+
/// Worktree specific configuration file, e.g. $GIT_DIR/config.worktree
389+
Worktree,
388390
/// Application specific configuration file
389391
App,
390392
/// Highest level available
@@ -662,6 +664,17 @@ bitflags! {
662664
}
663665
}
664666

667+
bitflags! {
668+
/// How to handle reference updates.
669+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
670+
pub struct RemoteUpdateFlags: u32 {
671+
/// Write the fetch results to FETCH_HEAD.
672+
const UPDATE_FETCHHEAD = raw::GIT_REMOTE_UPDATE_FETCHHEAD as u32;
673+
/// Report unchanged tips in the update_tips callback.
674+
const REPORT_UNCHANGED = raw::GIT_REMOTE_UPDATE_REPORT_UNCHANGED as u32;
675+
}
676+
}
677+
665678
#[cfg(test)]
666679
#[macro_use]
667680
mod test;
@@ -963,6 +976,7 @@ impl ConfigLevel {
963976
raw::GIT_CONFIG_LEVEL_XDG => ConfigLevel::XDG,
964977
raw::GIT_CONFIG_LEVEL_GLOBAL => ConfigLevel::Global,
965978
raw::GIT_CONFIG_LEVEL_LOCAL => ConfigLevel::Local,
979+
raw::GIT_CONFIG_LEVEL_WORKTREE => ConfigLevel::Worktree,
966980
raw::GIT_CONFIG_LEVEL_APP => ConfigLevel::App,
967981
raw::GIT_CONFIG_HIGHEST_LEVEL => ConfigLevel::Highest,
968982
n => panic!("unknown config level: {}", n),

0 commit comments

Comments
 (0)