Skip to content

Update libgit2 submodule. #503

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

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "libgit2-sys/libgit2"]
path = libgit2-sys/libgit2
url = https://github.com/libgit2/libgit2
branch = maint/v0.28
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.10.2"
version = "0.11.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
license = "MIT/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.9.2" }
libgit2-sys = { path = "libgit2-sys", version = "0.10.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 git2-curl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2018"
curl = "0.4"
url = "2.0"
log = "0.4"
git2 = { path = "..", version = "0.10", default-features = false }
git2 = { path = "..", version = "0.11", default-features = false }

[dev-dependencies]
civet = "0.11"
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.9.2"
version = "0.10.0"
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
links = "git2"
build = "build.rs"
Expand Down
21 changes: 14 additions & 7 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ pub struct git_time {

pub type git_off_t = i64;
pub type git_time_t = i64;
pub type git_object_size_t = u64;

git_enum! {
pub enum git_revparse_mode_t {
Expand Down Expand Up @@ -401,6 +402,7 @@ git_enum! {
GIT_CERT_NONE,
GIT_CERT_X509,
GIT_CERT_HOSTKEY_LIBSSH2,
GIT_CERT_STRARRAY,
}
}

Expand All @@ -415,6 +417,7 @@ pub struct git_cert_hostkey {
pub kind: git_cert_ssh_t,
pub hash_md5: [u8; 16],
pub hash_sha1: [u8; 20],
pub hash_sha256: [u8; 32],
}

#[repr(C)]
Expand All @@ -428,6 +431,7 @@ git_enum! {
pub enum git_cert_ssh_t {
GIT_CERT_SSH_MD5 = 1 << 0,
GIT_CERT_SSH_SHA1 = 1 << 1,
GIT_CERT_SSH_SHA256 = 1 << 2,
}
}

Expand All @@ -447,9 +451,10 @@ pub struct git_transfer_progress {
pub struct git_diff_file {
pub id: git_oid,
pub path: *const c_char,
pub size: git_off_t,
pub size: git_object_size_t,
pub flags: u32,
pub mode: u16,
pub id_abbrev: u16,
}

pub type git_repository_create_cb =
Expand Down Expand Up @@ -819,6 +824,7 @@ pub const GIT_ATTR_CHECK_FILE_THEN_INDEX: u32 = 0;
pub const GIT_ATTR_CHECK_INDEX_THEN_FILE: u32 = 1;
pub const GIT_ATTR_CHECK_INDEX_ONLY: u32 = 2;
pub const GIT_ATTR_CHECK_NO_SYSTEM: u32 = 1 << 2;
pub const GIT_ATTR_CHECK_INCLUDE_HEAD: u32 = 1 << 3;

#[repr(C)]
pub struct git_cred {
Expand Down Expand Up @@ -1046,6 +1052,7 @@ git_enum! {
GIT_DIFF_FORMAT_RAW = 3,
GIT_DIFF_FORMAT_NAME_ONLY = 4,
GIT_DIFF_FORMAT_NAME_STATUS = 5,
GIT_DIFF_FORMAT_PATCH_ID = 6,
}
}

Expand Down Expand Up @@ -1169,14 +1176,14 @@ git_enum! {
#[repr(C)]
pub struct git_merge_options {
pub version: c_uint,
pub flags: git_merge_flag_t,
pub flags: u32,
pub rename_threshold: c_uint,
pub target_limit: c_uint,
pub metric: *mut git_diff_similarity_metric,
pub recursion_limit: c_uint,
pub default_driver: *const c_char,
pub file_favor: git_merge_file_favor_t,
pub file_flags: git_merge_file_flag_t,
pub file_flags: u32,
}

git_enum! {
Expand Down Expand Up @@ -1337,7 +1344,7 @@ pub struct git_odb_backend {
extern "C" fn(
*mut *mut git_odb_stream,
*mut git_odb_backend,
git_off_t,
git_object_size_t,
git_object_t,
) -> c_int,
>,
Expand Down Expand Up @@ -1573,7 +1580,7 @@ git_enum! {
#[repr(C)]
pub struct git_stash_apply_options {
pub version: c_uint,
pub flags: git_stash_apply_flags,
pub flags: u32,
pub checkout_options: git_checkout_options,
pub progress_cb: Option<git_stash_apply_progress_cb>,
pub progress_payload: *mut c_void,
Expand Down Expand Up @@ -2206,7 +2213,7 @@ extern "C" {
len: size_t,
) -> c_int;
pub fn git_blob_rawcontent(blob: *const git_blob) -> *const c_void;
pub fn git_blob_rawsize(blob: *const git_blob) -> git_off_t;
pub fn git_blob_rawsize(blob: *const git_blob) -> git_object_size_t;
pub fn git_blob_create_frombuffer(
id: *mut git_oid,
repo: *mut git_repository,
Expand Down Expand Up @@ -3298,7 +3305,7 @@ extern "C" {
pub fn git_odb_open_wstream(
out: *mut *mut git_odb_stream,
db: *mut git_odb,
size: git_off_t,
size: git_object_size_t,
obj_type: git_object_t,
) -> c_int;
pub fn git_odb_stream_write(
Expand Down
2 changes: 1 addition & 1 deletion libgit2-sys/libgit2
Submodule libgit2 updated 297 files
1 change: 1 addition & 0 deletions src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ mod impls {
DiffFormat::Raw => raw::GIT_DIFF_FORMAT_RAW,
DiffFormat::NameOnly => raw::GIT_DIFF_FORMAT_NAME_ONLY,
DiffFormat::NameStatus => raw::GIT_DIFF_FORMAT_NAME_STATUS,
DiffFormat::PatchId => raw::GIT_DIFF_FORMAT_PATCH_ID,
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ impl<'a> CertHostkey<'a> {
}
}
}

/// Returns the SHA-256 hash of the hostkey, if available.
pub fn hash_sha256(&self) -> Option<&[u8; 32]> {
unsafe {
if (*self.raw).kind as u32 & raw::GIT_CERT_SSH_SHA256 as u32 == 0 {
None
} else {
Some(&(*self.raw).hash_sha256)
}
}
}
}

impl<'a> CertX509<'a> {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ pub enum DiffFormat {
NameOnly,
/// like git diff --name-status
NameStatus,
/// git diff as used by git patch-id
PatchId,
}

bitflags! {
Expand Down
28 changes: 14 additions & 14 deletions src/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl MergeOptions {
opts
}

fn flag(&mut self, opt: raw::git_merge_flag_t, val: bool) -> &mut MergeOptions {
fn flag(&mut self, opt: u32, val: bool) -> &mut MergeOptions {
if val {
self.raw.flags |= opt;
} else {
Expand All @@ -55,25 +55,25 @@ impl MergeOptions {

/// Detect file renames
pub fn find_renames(&mut self, find: bool) -> &mut MergeOptions {
self.flag(raw::GIT_MERGE_FIND_RENAMES, find)
self.flag(raw::GIT_MERGE_FIND_RENAMES as u32, find)
}

/// If a conflict occurs, exit immediately instead of attempting to continue
/// resolving conflicts
pub fn fail_on_conflict(&mut self, fail: bool) -> &mut MergeOptions {
self.flag(raw::GIT_MERGE_FAIL_ON_CONFLICT, fail)
self.flag(raw::GIT_MERGE_FAIL_ON_CONFLICT as u32, fail)
}

/// Do not write the REUC extension on the generated index
pub fn skip_reuc(&mut self, skip: bool) -> &mut MergeOptions {
self.flag(raw::GIT_MERGE_FAIL_ON_CONFLICT, skip)
self.flag(raw::GIT_MERGE_FAIL_ON_CONFLICT as u32, skip)
}

/// If the commits being merged have multiple merge bases, do not build a
/// recursive merge base (by merging the multiple merge bases), instead
/// simply use the first base.
pub fn no_recursive(&mut self, disable: bool) -> &mut MergeOptions {
self.flag(raw::GIT_MERGE_NO_RECURSIVE, disable)
self.flag(raw::GIT_MERGE_NO_RECURSIVE as u32, disable)
}

/// Similarity to consider a file renamed (default 50)
Expand Down Expand Up @@ -106,7 +106,7 @@ impl MergeOptions {
self
}

fn file_flag(&mut self, opt: raw::git_merge_file_flag_t, val: bool) -> &mut MergeOptions {
fn file_flag(&mut self, opt: u32, val: bool) -> &mut MergeOptions {
if val {
self.raw.file_flags |= opt;
} else {
Expand All @@ -117,42 +117,42 @@ impl MergeOptions {

/// Create standard conflicted merge files
pub fn standard_style(&mut self, standard: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_STYLE_MERGE, standard)
self.file_flag(raw::GIT_MERGE_FILE_STYLE_MERGE as u32, standard)
}

/// Create diff3-style file
pub fn diff3_style(&mut self, diff3: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_STYLE_DIFF3, diff3)
self.file_flag(raw::GIT_MERGE_FILE_STYLE_DIFF3 as u32, diff3)
}

/// Condense non-alphanumeric regions for simplified diff file
pub fn simplify_alnum(&mut self, simplify: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_SIMPLIFY_ALNUM, simplify)
self.file_flag(raw::GIT_MERGE_FILE_SIMPLIFY_ALNUM as u32, simplify)
}

/// Ignore all whitespace
pub fn ignore_whitespace(&mut self, ignore: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE, ignore)
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE as u32, ignore)
}

/// Ignore changes in amount of whitespace
pub fn ignore_whitespace_change(&mut self, ignore: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE, ignore)
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE as u32, ignore)
}

/// Ignore whitespace at end of line
pub fn ignore_whitespace_eol(&mut self, ignore: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL, ignore)
self.file_flag(raw::GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL as u32, ignore)
}

/// Use the "patience diff" algorithm
pub fn patience(&mut self, patience: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_DIFF_PATIENCE, patience)
self.file_flag(raw::GIT_MERGE_FILE_DIFF_PATIENCE as u32, patience)
}

/// Take extra time to find minimal diff
pub fn minimal(&mut self, minimal: bool) -> &mut MergeOptions {
self.file_flag(raw::GIT_MERGE_FILE_DIFF_MINIMAL, minimal)
self.file_flag(raw::GIT_MERGE_FILE_DIFF_MINIMAL as u32, minimal)
}

/// Acquire a pointer to the underlying raw options.
Expand Down
2 changes: 1 addition & 1 deletion src/odb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<'repo> Odb<'repo> {
try_call!(raw::git_odb_open_wstream(
&mut out,
self.raw,
size as raw::git_off_t,
size as raw::git_object_size_t,
obj_type.raw()
));
Ok(OdbWriter::from_raw(out))
Expand Down
2 changes: 1 addition & 1 deletion src/stash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'cb> StashApplyOptions<'cb> {

/// Set stash application flag to GIT_STASH_APPLY_REINSTATE_INDEX
pub fn reinstantiate_index(&mut self) -> &mut StashApplyOptions<'cb> {
self.raw_opts.flags = raw::GIT_STASH_APPLY_REINSTATE_INDEX;
self.raw_opts.flags = raw::GIT_STASH_APPLY_REINSTATE_INDEX as u32;
self
}

Expand Down
1 change: 1 addition & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn main() {
.header("git2/sys/odb_backend.h")
.header("git2/sys/mempack.h")
.header("git2/sys/repository.h")
.header("git2/sys/cred.h")
.header("git2/cred_helpers.h")
.type_name(|s, _, _| s.to_string());
cfg.field_name(|_, f| match f {
Expand Down