Skip to content

Commit a80e6ea

Browse files
nossralfalexcrichton
authored andcommitted
Update libgit2 submodule. (#503)
1 parent abd3785 commit a80e6ea

File tree

13 files changed

+50
-29
lines changed

13 files changed

+50
-29
lines changed

.gitmodules

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[submodule "libgit2-sys/libgit2"]
22
path = libgit2-sys/libgit2
33
url = https://github.com/libgit2/libgit2
4-
branch = maint/v0.28

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "git2"
3-
version = "0.10.2"
3+
version = "0.11.0"
44
authors = ["Josh Triplett <[email protected]>", "Alex Crichton <[email protected]>"]
55
license = "MIT/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.9.2" }
23+
libgit2-sys = { path = "libgit2-sys", version = "0.10.0" }
2424

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

git2-curl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ edition = "2018"
1717
curl = "0.4"
1818
url = "2.0"
1919
log = "0.4"
20-
git2 = { path = "..", version = "0.10", default-features = false }
20+
git2 = { path = "..", version = "0.11", default-features = false }
2121

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

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

libgit2-sys/lib.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ pub struct git_time {
148148

149149
pub type git_off_t = i64;
150150
pub type git_time_t = i64;
151+
pub type git_object_size_t = u64;
151152

152153
git_enum! {
153154
pub enum git_revparse_mode_t {
@@ -401,6 +402,7 @@ git_enum! {
401402
GIT_CERT_NONE,
402403
GIT_CERT_X509,
403404
GIT_CERT_HOSTKEY_LIBSSH2,
405+
GIT_CERT_STRARRAY,
404406
}
405407
}
406408

@@ -415,6 +417,7 @@ pub struct git_cert_hostkey {
415417
pub kind: git_cert_ssh_t,
416418
pub hash_md5: [u8; 16],
417419
pub hash_sha1: [u8; 20],
420+
pub hash_sha256: [u8; 32],
418421
}
419422

420423
#[repr(C)]
@@ -428,6 +431,7 @@ git_enum! {
428431
pub enum git_cert_ssh_t {
429432
GIT_CERT_SSH_MD5 = 1 << 0,
430433
GIT_CERT_SSH_SHA1 = 1 << 1,
434+
GIT_CERT_SSH_SHA256 = 1 << 2,
431435
}
432436
}
433437

@@ -447,9 +451,10 @@ pub struct git_transfer_progress {
447451
pub struct git_diff_file {
448452
pub id: git_oid,
449453
pub path: *const c_char,
450-
pub size: git_off_t,
454+
pub size: git_object_size_t,
451455
pub flags: u32,
452456
pub mode: u16,
457+
pub id_abbrev: u16,
453458
}
454459

455460
pub type git_repository_create_cb =
@@ -819,6 +824,7 @@ pub const GIT_ATTR_CHECK_FILE_THEN_INDEX: u32 = 0;
819824
pub const GIT_ATTR_CHECK_INDEX_THEN_FILE: u32 = 1;
820825
pub const GIT_ATTR_CHECK_INDEX_ONLY: u32 = 2;
821826
pub const GIT_ATTR_CHECK_NO_SYSTEM: u32 = 1 << 2;
827+
pub const GIT_ATTR_CHECK_INCLUDE_HEAD: u32 = 1 << 3;
822828

823829
#[repr(C)]
824830
pub struct git_cred {
@@ -1046,6 +1052,7 @@ git_enum! {
10461052
GIT_DIFF_FORMAT_RAW = 3,
10471053
GIT_DIFF_FORMAT_NAME_ONLY = 4,
10481054
GIT_DIFF_FORMAT_NAME_STATUS = 5,
1055+
GIT_DIFF_FORMAT_PATCH_ID = 6,
10491056
}
10501057
}
10511058

@@ -1169,14 +1176,14 @@ git_enum! {
11691176
#[repr(C)]
11701177
pub struct git_merge_options {
11711178
pub version: c_uint,
1172-
pub flags: git_merge_flag_t,
1179+
pub flags: u32,
11731180
pub rename_threshold: c_uint,
11741181
pub target_limit: c_uint,
11751182
pub metric: *mut git_diff_similarity_metric,
11761183
pub recursion_limit: c_uint,
11771184
pub default_driver: *const c_char,
11781185
pub file_favor: git_merge_file_favor_t,
1179-
pub file_flags: git_merge_file_flag_t,
1186+
pub file_flags: u32,
11801187
}
11811188

11821189
git_enum! {
@@ -1337,7 +1344,7 @@ pub struct git_odb_backend {
13371344
extern "C" fn(
13381345
*mut *mut git_odb_stream,
13391346
*mut git_odb_backend,
1340-
git_off_t,
1347+
git_object_size_t,
13411348
git_object_t,
13421349
) -> c_int,
13431350
>,
@@ -1573,7 +1580,7 @@ git_enum! {
15731580
#[repr(C)]
15741581
pub struct git_stash_apply_options {
15751582
pub version: c_uint,
1576-
pub flags: git_stash_apply_flags,
1583+
pub flags: u32,
15771584
pub checkout_options: git_checkout_options,
15781585
pub progress_cb: Option<git_stash_apply_progress_cb>,
15791586
pub progress_payload: *mut c_void,
@@ -2206,7 +2213,7 @@ extern "C" {
22062213
len: size_t,
22072214
) -> c_int;
22082215
pub fn git_blob_rawcontent(blob: *const git_blob) -> *const c_void;
2209-
pub fn git_blob_rawsize(blob: *const git_blob) -> git_off_t;
2216+
pub fn git_blob_rawsize(blob: *const git_blob) -> git_object_size_t;
22102217
pub fn git_blob_create_frombuffer(
22112218
id: *mut git_oid,
22122219
repo: *mut git_repository,
@@ -3298,7 +3305,7 @@ extern "C" {
32983305
pub fn git_odb_open_wstream(
32993306
out: *mut *mut git_odb_stream,
33003307
db: *mut git_odb,
3301-
size: git_off_t,
3308+
size: git_object_size_t,
33023309
obj_type: git_object_t,
33033310
) -> c_int;
33043311
pub fn git_odb_stream_write(

libgit2-sys/libgit2

Submodule libgit2 updated 297 files

src/call.rs

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ mod impls {
181181
DiffFormat::Raw => raw::GIT_DIFF_FORMAT_RAW,
182182
DiffFormat::NameOnly => raw::GIT_DIFF_FORMAT_NAME_ONLY,
183183
DiffFormat::NameStatus => raw::GIT_DIFF_FORMAT_NAME_STATUS,
184+
DiffFormat::PatchId => raw::GIT_DIFF_FORMAT_PATCH_ID,
184185
}
185186
}
186187
}

src/cert.rs

+11
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ impl<'a> CertHostkey<'a> {
7676
}
7777
}
7878
}
79+
80+
/// Returns the SHA-256 hash of the hostkey, if available.
81+
pub fn hash_sha256(&self) -> Option<&[u8; 32]> {
82+
unsafe {
83+
if (*self.raw).kind as u32 & raw::GIT_CERT_SSH_SHA256 as u32 == 0 {
84+
None
85+
} else {
86+
Some(&(*self.raw).hash_sha256)
87+
}
88+
}
89+
}
7990
}
8091

8192
impl<'a> CertX509<'a> {

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,8 @@ pub enum DiffFormat {
11871187
NameOnly,
11881188
/// like git diff --name-status
11891189
NameStatus,
1190+
/// git diff as used by git patch-id
1191+
PatchId,
11901192
}
11911193

11921194
bitflags! {

src/merge.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl MergeOptions {
4444
opts
4545
}
4646

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

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

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

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

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

7979
/// Similarity to consider a file renamed (default 50)
@@ -106,7 +106,7 @@ impl MergeOptions {
106106
self
107107
}
108108

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

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

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

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

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

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

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

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

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

158158
/// Acquire a pointer to the underlying raw options.

src/odb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'repo> Odb<'repo> {
8181
try_call!(raw::git_odb_open_wstream(
8282
&mut out,
8383
self.raw,
84-
size as raw::git_off_t,
84+
size as raw::git_object_size_t,
8585
obj_type.raw()
8686
));
8787
Ok(OdbWriter::from_raw(out))

src/stash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'cb> StashApplyOptions<'cb> {
4646

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

systest/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn main() {
1313
.header("git2/sys/odb_backend.h")
1414
.header("git2/sys/mempack.h")
1515
.header("git2/sys/repository.h")
16+
.header("git2/sys/cred.h")
1617
.header("git2/cred_helpers.h")
1718
.type_name(|s, _, _| s.to_string());
1819
cfg.field_name(|_, f| match f {

0 commit comments

Comments
 (0)