Skip to content

Commit 0b1639f

Browse files
davidknaehuss
andcommitted
Add EOWNER and use main libgit2 branch
Co-Authored-By: Eric Huss <[email protected]>
1 parent efa63de commit 0b1639f

File tree

5 files changed

+38
-18
lines changed

5 files changed

+38
-18
lines changed

Diff for: libgit2-sys/build.rs

+31-17
Original file line numberDiff line numberDiff line change
@@ -14,11 +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
18-
.range_version("1.4.3".."1.5.0")
19-
.print_system_libs(false)
20-
.probe("libgit2")
21-
{
17+
if let Ok(lib) = cfg.range_version("1.4.3".."1.5.0").probe("libgit2") {
2218
for include in &lib.include_paths {
2319
println!("cargo:root={}", include.display());
2420
}
@@ -45,20 +41,21 @@ fn main() {
4541
cp_r("libgit2/include", &include);
4642

4743
cfg.include(&include)
48-
.include("libgit2/src")
44+
.include("libgit2/src/libgit2")
4945
.include("libgit2/src/util")
5046
.out_dir(dst.join("build"))
5147
.warnings(false);
5248

5349
// Include all cross-platform C files
54-
add_c_files(&mut cfg, "libgit2/src");
55-
add_c_files(&mut cfg, "libgit2/src/xdiff");
50+
add_c_files(&mut cfg, "libgit2/src/libgit2");
51+
add_c_files(&mut cfg, "libgit2/src/util");
52+
add_c_files(&mut cfg, "libgit2/src/libgit2/xdiff");
5653

5754
// These are activated by features, but they're all unconditionally always
5855
// compiled apparently and have internal #define's to make sure they're
5956
// compiled correctly.
60-
add_c_files(&mut cfg, "libgit2/src/transports");
61-
add_c_files(&mut cfg, "libgit2/src/streams");
57+
add_c_files(&mut cfg, "libgit2/src/libgit2/transports");
58+
add_c_files(&mut cfg, "libgit2/src/libgit2/streams");
6259

6360
// Always use bundled http-parser for now
6461
cfg.include("libgit2/deps/http-parser")
@@ -87,11 +84,11 @@ fn main() {
8784
// when when COMPILE_PCRE8 is not defined, which is the default.
8885
add_c_files(&mut cfg, "libgit2/deps/pcre");
8986

90-
cfg.file("libgit2/src/allocators/failalloc.c");
91-
cfg.file("libgit2/src/allocators/stdalloc.c");
87+
cfg.file("libgit2/src/util/allocators/failalloc.c");
88+
cfg.file("libgit2/src/util/allocators/stdalloc.c");
9289

9390
if windows {
94-
add_c_files(&mut cfg, "libgit2/src/win32");
91+
add_c_files(&mut cfg, "libgit2/src/util/win32");
9592
cfg.define("STRSAFE_NO_DEPRECATE", None);
9693
cfg.define("WIN32", None);
9794
cfg.define("_WIN32_WINNT", Some("0x0600"));
@@ -103,7 +100,7 @@ fn main() {
103100
cfg.define("__USE_MINGW_ANSI_STDIO", "1");
104101
}
105102
} else {
106-
add_c_files(&mut cfg, "libgit2/src/unix");
103+
add_c_files(&mut cfg, "libgit2/src/util/unix");
107104
cfg.flag("-fvisibility=hidden");
108105
}
109106
if target.contains("solaris") || target.contains("illumos") {
@@ -161,9 +158,26 @@ fn main() {
161158
cfg.define("SHA1DC_NO_STANDARD_INCLUDES", "1");
162159
cfg.define("SHA1DC_CUSTOM_INCLUDE_SHA1_C", "\"common.h\"");
163160
cfg.define("SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C", "\"common.h\"");
164-
cfg.file("libgit2/src/hash/sha1/collisiondetect.c");
165-
cfg.file("libgit2/src/hash/sha1/sha1dc/sha1.c");
166-
cfg.file("libgit2/src/hash/sha1/sha1dc/ubc_check.c");
161+
cfg.file("libgit2/src/util/hash/collisiondetect.c");
162+
cfg.file("libgit2/src/util/hash/sha1dc/sha1.c");
163+
cfg.file("libgit2/src/util/hash/sha1dc/ubc_check.c");
164+
165+
if https {
166+
if windows {
167+
features.push_str("#define GIT_SHA256_WIN32 1\n");
168+
cfg.file("libgit2/src/util/hash/win32.c");
169+
} else if target.contains("apple") {
170+
features.push_str("#define GIT_SHA256_COMMON_CRYPTO 1\n");
171+
cfg.file("libgit2/src/util/hash/common_crypto.c");
172+
} else {
173+
features.push_str("#define GIT_SHA256_OPENSSL 1\n");
174+
cfg.file("libgit2/src/util/hash/openssl.c");
175+
}
176+
} else {
177+
features.push_str("#define GIT_SHA256_BUILTIN 1\n");
178+
cfg.file("libgit2/src/util/hash/builtin.c");
179+
cfg.file("libgit2/src/util/hash/rfc6234/sha224-256.c");
180+
}
167181

168182
if let Some(path) = env::var_os("DEP_Z_INCLUDE") {
169183
cfg.include(path);

Diff for: libgit2-sys/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ git_enum! {
195195
GIT_EMISMATCH = -33,
196196
GIT_EINDEXDIRTY = -34,
197197
GIT_EAPPLYFAIL = -35,
198+
GIT_EOWNER = -36,
198199
}
199200
}
200201

Diff for: libgit2-sys/libgit2

Submodule libgit2 updated 931 files

Diff for: src/error.rs

+3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ impl Error {
127127
raw::GIT_EMISMATCH => super::ErrorCode::HashsumMismatch,
128128
raw::GIT_EINDEXDIRTY => super::ErrorCode::IndexDirty,
129129
raw::GIT_EAPPLYFAIL => super::ErrorCode::ApplyFail,
130+
raw::GIT_EOWNER => super::ErrorCode::Owner,
130131
_ => super::ErrorCode::GenericError,
131132
}
132133
}
@@ -163,6 +164,7 @@ impl Error {
163164
ErrorCode::HashsumMismatch => raw::GIT_EMISMATCH,
164165
ErrorCode::IndexDirty => raw::GIT_EINDEXDIRTY,
165166
ErrorCode::ApplyFail => raw::GIT_EAPPLYFAIL,
167+
ErrorCode::Owner => raw::GIT_EOWNER,
166168
};
167169
}
168170

@@ -293,6 +295,7 @@ impl Error {
293295
GIT_EMISMATCH,
294296
GIT_EINDEXDIRTY,
295297
GIT_EAPPLYFAIL,
298+
GIT_EOWNER,
296299
)
297300
}
298301

Diff for: src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ pub enum ErrorCode {
214214
IndexDirty,
215215
/// Patch application failed
216216
ApplyFail,
217+
/// The object is not owned by the current user
218+
Owner,
217219
}
218220

219221
/// An enumeration of possible categories of things that can have

0 commit comments

Comments
 (0)