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

libgit2: Bump to v1.8.1 #1032

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b534e13
libgit2: Bump to v1.8.0
bnjmnt4n Mar 1, 2024
7fa64c6
remote: Update struct representation for `git_push_options`
bnjmnt4n Mar 2, 2024
cb8bbc6
lib: Add `RemoteUpdateFlags` bitflag
bnjmnt4n Mar 2, 2024
6cb97bc
remote: Update `git_remote_update_tips` to use `RemoteUpdateFlags`
bnjmnt4n Mar 2, 2024
3433353
remote: Update `git_fetch_options` to use `RemoteUpdateFlags`
bnjmnt4n Mar 2, 2024
b766291
libgit2-sys: Update struct representation for `git_config_entry`
bnjmnt4n Mar 2, 2024
202b38c
libgit2-sys: Add new git error code enums
bnjmnt4n Mar 2, 2024
ee69ec5
repo: Update `git_commit_create` and `git_commit_create_buffer`
bnjmnt4n Mar 2, 2024
8b5fba7
lib: Add `ConfigLevel::Worktree`
bnjmnt4n Mar 22, 2024
c074cab
worktree: Update struct representation for `git_worktree_add_options`
bnjmnt4n Mar 22, 2024
3bde019
libgit2-sys: Fix build issue with libssh2
bnjmnt4n Mar 2, 2024
26853d9
tests: Account for new `worktreeconfig` extension added
bnjmnt4n Mar 22, 2024
eeb04b9
cred/tests: Account for changes in `git_config`
bnjmnt4n Mar 22, 2024
e21a5de
test: Fix `realpath` failure on Windows
bnjmnt4n Mar 23, 2024
2a617b6
systest: Add `errors.h` header file
bnjmnt4n Mar 2, 2024
a65e7a4
libgit2-sys: Bump versions
bnjmnt4n Mar 22, 2024
449c6be
libgit2: Bump to v1.8.1
bnjmnt4n May 15, 2024
8640496
libgit2-sys: Switch to new bundled llhttp HTTP parser
bnjmnt4n May 15, 2024
78872dd
remote: Update `git_fetch_options` to use bitflags instead of bitfields
bnjmnt4n May 15, 2024
938df21
libgit2-sys: Add updated enum values for `git_libgit2_opt_t`
bnjmnt4n May 16, 2024
76ecfe7
contributing: Add note about `git diff`
bnjmnt4n Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Expand Up @@ -31,6 +31,7 @@ The following steps can be used to update libgit2:
can be helpful for seeing what has changed.
The project has recently started labeling API and ABI breaking changes with labels:
<https://github.com/libgit2/libgit2/pulls?q=is%3Apr+label%3A%22api+breaking%22%2C%22abi+breaking%22+is%3Aclosed>
Alternatively, running `git diff [PREV_VERSION]..[NEW_VERSION] --ignore-all-space -- include/` can provide an overview of changes made to the API.
4. Once you have everything functional, publish a PR with the updates.

## Release process
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -20,7 +20,7 @@ url = "2.0"
bitflags = "2.1.0"
libc = "0.2"
log = "0.4.8"
libgit2-sys = { path = "libgit2-sys", version = "0.16.2" }
libgit2-sys = { path = "libgit2-sys", version = "0.17.0" }

[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
openssl-sys = { version = "0.9.45", optional = true }
Expand Down
9 changes: 7 additions & 2 deletions examples/fetch.rs
Expand Up @@ -15,7 +15,7 @@
#![deny(warnings)]

use clap::Parser;
use git2::{AutotagOption, FetchOptions, RemoteCallbacks, Repository};
use git2::{AutotagOption, FetchOptions, RemoteCallbacks, RemoteUpdateFlags, Repository};
use std::io::{self, Write};
use std::str;

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

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libgit2-sys"
version = "0.16.2+1.7.2"
version = "0.17.0+1.8.1"
authors = ["Josh Triplett <josh@joshtriplett.org>", "Alex Crichton <alex@alexcrichton.com>"]
links = "git2"
build = "build.rs"
Expand Down
12 changes: 7 additions & 5 deletions libgit2-sys/build.rs
Expand Up @@ -7,7 +7,7 @@ use std::process::Command;
/// Tries to use system libgit2 and emits necessary build script instructions.
fn try_system_libgit2() -> Result<pkg_config::Library, pkg_config::Error> {
let mut cfg = pkg_config::Config::new();
match cfg.range_version("1.7.2".."1.8.0").probe("libgit2") {
match cfg.range_version("1.8.1".."1.9.0").probe("libgit2") {
Ok(lib) => {
for include in &lib.include_paths {
println!("cargo:root={}", include.display());
Expand Down Expand Up @@ -89,9 +89,9 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
add_c_files(&mut cfg, "libgit2/src/libgit2/transports");
add_c_files(&mut cfg, "libgit2/src/libgit2/streams");

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

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

if !target.contains("android") {
features.push_str("#define GIT_USE_NSEC 1\n");
Expand Down Expand Up @@ -180,7 +181,8 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
cfg.include(path);
}
features.push_str("#define GIT_SSH 1\n");
features.push_str("#define GIT_SSH_MEMORY_CREDENTIALS 1\n");
features.push_str("#define GIT_SSH_LIBSSH2 1\n");
features.push_str("#define GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1\n");
}
if https {
features.push_str("#define GIT_HTTPS 1\n");
Expand Down
35 changes: 29 additions & 6 deletions libgit2-sys/lib.rs
Expand Up @@ -198,6 +198,10 @@ git_enum! {
GIT_EINDEXDIRTY = -34,
GIT_EAPPLYFAIL = -35,
GIT_EOWNER = -36,
GIT_TIMEOUT = -37,
GIT_EUNCHANGED = -38,
GIT_ENOTSUPPORTED = -39,
GIT_EREADONLY = -40,
}
}

Expand Down Expand Up @@ -366,6 +370,13 @@ pub struct git_indexer_options {

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

git_enum! {
pub enum git_remote_update_flags {
GIT_REMOTE_UPDATE_FETCHHEAD = 1 << 0,
GIT_REMOTE_UPDATE_REPORT_UNCHANGED = 1 << 1,
}
}

#[repr(C)]
pub struct git_remote_callbacks {
pub version: c_uint,
Expand All @@ -391,7 +402,7 @@ pub struct git_fetch_options {
pub version: c_int,
pub callbacks: git_remote_callbacks,
pub prune: git_fetch_prune_t,
pub update_fetchhead: c_int,
pub update_fetchhead: c_uint,
pub download_tags: git_remote_autotag_option_t,
pub proxy_opts: git_proxy_options,
pub depth: c_int,
Expand Down Expand Up @@ -855,10 +866,11 @@ pub struct git_index_time {
pub struct git_config_entry {
pub name: *const c_char,
pub value: *const c_char,
pub backend_type: *const c_char,
pub origin_path: *const c_char,
pub include_depth: c_uint,
pub level: git_config_level_t,
pub free: Option<extern "C" fn(*mut git_config_entry)>,
pub payload: *mut c_void,
}

git_enum! {
Expand All @@ -868,7 +880,8 @@ git_enum! {
GIT_CONFIG_LEVEL_XDG = 3,
GIT_CONFIG_LEVEL_GLOBAL = 4,
GIT_CONFIG_LEVEL_LOCAL = 5,
GIT_CONFIG_LEVEL_APP = 6,
GIT_CONFIG_LEVEL_WORKTREE = 6,
GIT_CONFIG_LEVEL_APP = 7,
GIT_CONFIG_HIGHEST_LEVEL = -1,
}
}
Expand Down Expand Up @@ -981,6 +994,7 @@ pub struct git_push_options {
pub proxy_opts: git_proxy_options,
pub follow_redirects: git_remote_redirect_t,
pub custom_headers: git_strarray,
pub remote_push_options: git_strarray,
}

pub type git_tag_foreach_cb =
Expand Down Expand Up @@ -1947,6 +1961,14 @@ git_enum! {
GIT_OPT_SET_EXTENSIONS,
GIT_OPT_GET_OWNER_VALIDATION,
GIT_OPT_SET_OWNER_VALIDATION,
GIT_OPT_GET_HOMEDIR,
GIT_OPT_SET_HOMEDIR,
GIT_OPT_SET_SERVER_CONNECT_TIMEOUT,
GIT_OPT_GET_SERVER_CONNECT_TIMEOUT,
GIT_OPT_SET_SERVER_TIMEOUT,
GIT_OPT_GET_SERVER_TIMEOUT,
GIT_OPT_SET_USER_AGENT_PRODUCT,
GIT_OPT_GET_USER_AGENT_PRODUCT,
}
}

Expand All @@ -1963,6 +1985,7 @@ git_enum! {
pub struct git_worktree_add_options {
pub version: c_uint,
pub lock: c_int,
pub checkout_existing: c_int,
pub reference: *mut git_reference,
pub checkout_options: git_checkout_options,
}
Expand Down Expand Up @@ -2326,7 +2349,7 @@ extern "C" {
pub fn git_remote_update_tips(
remote: *mut git_remote,
callbacks: *const git_remote_callbacks,
update_fetchead: c_int,
update_flags: c_uint,
download_tags: git_remote_autotag_option_t,
reflog_message: *const c_char,
) -> c_int;
Expand Down Expand Up @@ -2882,7 +2905,7 @@ extern "C" {
message: *const c_char,
tree: *const git_tree,
parent_count: size_t,
parents: *mut *const git_commit,
parents: *const *mut git_commit,
) -> c_int;
pub fn git_commit_create_buffer(
out: *mut git_buf,
Expand All @@ -2893,7 +2916,7 @@ extern "C" {
message: *const c_char,
tree: *const git_tree,
parent_count: size_t,
parents: *mut *const git_commit,
parents: *const *mut git_commit,
) -> c_int;
pub fn git_commit_header_field(
out: *mut git_buf,
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/libgit2
Submodule libgit2 updated 342 files
1 change: 1 addition & 0 deletions src/call.rs
Expand Up @@ -166,6 +166,7 @@ mod impls {
ConfigLevel::XDG => raw::GIT_CONFIG_LEVEL_XDG,
ConfigLevel::Global => raw::GIT_CONFIG_LEVEL_GLOBAL,
ConfigLevel::Local => raw::GIT_CONFIG_LEVEL_LOCAL,
ConfigLevel::Worktree => raw::GIT_CONFIG_LEVEL_WORKTREE,
ConfigLevel::App => raw::GIT_CONFIG_LEVEL_APP,
ConfigLevel::Highest => raw::GIT_CONFIG_HIGHEST_LEVEL,
}
Expand Down
2 changes: 1 addition & 1 deletion src/cred.rs
Expand Up @@ -482,7 +482,7 @@ mod test {
macro_rules! test_cfg( ($($k:expr => $v:expr),*) => ({
let td = TempDir::new().unwrap();
let mut cfg = Config::new().unwrap();
cfg.add_file(&td.path().join("cfg"), ConfigLevel::Highest, false).unwrap();
cfg.add_file(&td.path().join("cfg"), ConfigLevel::App, false).unwrap();
$(cfg.set_str($k, $v).unwrap();)*
cfg
}) );
Expand Down
14 changes: 14 additions & 0 deletions src/lib.rs
Expand Up @@ -385,6 +385,8 @@ pub enum ConfigLevel {
Global,
/// Repository specific config, e.g. $PWD/.git/config
Local,
/// Worktree specific configuration file, e.g. $GIT_DIR/config.worktree
Worktree,
/// Application specific configuration file
App,
/// Highest level available
Expand Down Expand Up @@ -662,6 +664,17 @@ bitflags! {
}
}

bitflags! {
/// How to handle reference updates.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct RemoteUpdateFlags: u32 {
/// Write the fetch results to FETCH_HEAD.
const UPDATE_FETCHHEAD = raw::GIT_REMOTE_UPDATE_FETCHHEAD as u32;
/// Report unchanged tips in the update_tips callback.
const REPORT_UNCHANGED = raw::GIT_REMOTE_UPDATE_REPORT_UNCHANGED as u32;
}
}

#[cfg(test)]
#[macro_use]
mod test;
Expand Down Expand Up @@ -963,6 +976,7 @@ impl ConfigLevel {
raw::GIT_CONFIG_LEVEL_XDG => ConfigLevel::XDG,
raw::GIT_CONFIG_LEVEL_GLOBAL => ConfigLevel::Global,
raw::GIT_CONFIG_LEVEL_LOCAL => ConfigLevel::Local,
raw::GIT_CONFIG_LEVEL_WORKTREE => ConfigLevel::Worktree,
raw::GIT_CONFIG_LEVEL_APP => ConfigLevel::App,
raw::GIT_CONFIG_HIGHEST_LEVEL => ConfigLevel::Highest,
n => panic!("unknown config level: {}", n),
Expand Down