Skip to content

Commit 4d7fc84

Browse files
committed
Upgrade libgit2 to 1.3.0
1 parent 5c357e9 commit 4d7fc84

File tree

8 files changed

+15
-123
lines changed

8 files changed

+15
-123
lines changed

deps/libgit2.mk

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,14 @@ $(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied: $(LIBGIT2_SRC_PATH)/so
4040
patch -p1 -f < $(SRCDIR)/patches/libgit2-agent-nonfatal.patch
4141
echo 1 > $@
4242

43-
# This can be removed once a release with https://github.com/libgit2/libgit2/pull/5685 lands
44-
$(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied
45-
cd $(LIBGIT2_SRC_PATH) && \
46-
patch -p1 -f < $(SRCDIR)/patches/libgit2-mbedtls-incdir.patch
47-
echo 1 > $@
48-
49-
$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied
43+
$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied:
5044
cd $(LIBGIT2_SRC_PATH) && \
5145
patch -p1 -f < $(SRCDIR)/patches/libgit2-hostkey.patch
5246
echo 1 > $@
5347

54-
# This can be removed once a release with https://github.com/libgit2/libgit2/pull/5740 lands
55-
$(LIBGIT2_SRC_PATH)/libgit2-continue-zlib.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied
56-
cd $(LIBGIT2_SRC_PATH) && \
57-
patch -p1 -f < $(SRCDIR)/patches/libgit2-continue-zlib.patch
58-
echo 1 > $@
59-
6048
$(BUILDDIR)/$(LIBGIT2_SRC_DIR)/build-configured: \
6149
$(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied \
62-
$(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied \
63-
$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied \
64-
$(LIBGIT2_SRC_PATH)/libgit2-continue-zlib.patch-applied
50+
$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied
6551

6652
$(BUILDDIR)/$(LIBGIT2_SRC_DIR)/build-configured: $(LIBGIT2_SRC_PATH)/source-extracted
6753
mkdir -p $(dir $@)

deps/libgit2.version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
LIBGIT2_BRANCH=v1.1.0
2-
LIBGIT2_SHA1=7f4fa178629d559c037a1f72f79f79af9c1ef8ce
1+
LIBGIT2_BRANCH=v1.3.0
2+
LIBGIT2_SHA1=b7bad55e4bb0a285b073ba5e02b01d3f522fc95d

deps/patches/libgit2-continue-zlib.patch

Lines changed: 0 additions & 43 deletions
This file was deleted.

deps/patches/libgit2-hostkey.patch

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,16 @@
1-
diff --git a/include/git2/cert.h b/include/git2/cert.h
2-
index e8cd2d180..54293cd31 100644
3-
--- a/include/git2/cert.h
4-
+++ b/include/git2/cert.h
5-
@@ -111,6 +111,14 @@ typedef struct {
6-
* have the SHA-256 hash of the hostkey.
7-
*/
8-
unsigned char hash_sha256[32];
9-
+
10-
+ /**
11-
+ * Hostkey itself.
12-
+ */
13-
+ int hostkey_type;
14-
+ size_t hostkey_len;
15-
+ unsigned char hostkey[1024];
16-
+
17-
} git_cert_hostkey;
18-
19-
/**
201
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
21-
index f4ed05bb1..ec6366a5f 100644
2+
index 471c3273ed..32189d0979 100644
223
--- a/src/transports/ssh.c
234
+++ b/src/transports/ssh.c
24-
@@ -523,6 +523,7 @@ static int _git_ssh_setup_conn(
5+
@@ -525,6 +525,7 @@ static int _git_ssh_setup_conn(
256
git_credential *cred = NULL;
26-
LIBSSH2_SESSION* session=NULL;
27-
LIBSSH2_CHANNEL* channel=NULL;
7+
LIBSSH2_SESSION *session=NULL;
8+
LIBSSH2_CHANNEL *channel=NULL;
289
+ char *host_and_port;
2910

3011
t->current_stream = NULL;
3112

32-
@@ -566,6 +567,12 @@ post_extract:
33-
34-
cert.parent.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
35-
36-
+ key = libssh2_session_hostkey(session, &cert.hostkey_len, &cert.hostkey_type);
37-
+ bzero(&cert.hostkey, sizeof(cert.hostkey));
38-
+ if (cert.hostkey_len > sizeof(cert.hostkey))
39-
+ cert.hostkey_len = sizeof(cert.hostkey);
40-
+ memcpy(&cert.hostkey, key, cert.hostkey_len);
41-
+
42-
#ifdef LIBSSH2_HOSTKEY_HASH_SHA256
43-
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA256);
44-
if (key != NULL) {
45-
@@ -597,7 +604,15 @@ post_extract:
13+
@@ -636,7 +637,15 @@ post_extract:
4614

4715
cert_ptr = &cert;
4816

deps/patches/libgit2-mbedtls-incdir.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.

stdlib/LibGit2/src/callbacks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ struct CertHostKey
366366
sha1 :: NTuple{20,UInt8}
367367
sha256 :: NTuple{32,UInt8}
368368
type :: Cint
369+
hostkey :: Ptr{Cchar}
369370
len :: Csize_t
370-
data :: NTuple{1024,UInt8}
371371
end
372372

373373
function verify_host_error(message::AbstractString)

stdlib/LibGit2/src/types.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ Matches the [`git_remote_callbacks`](https://libgit2.org/libgit2/#HEAD/type/git_
230230
push_update_reference::Ptr{Cvoid} = C_NULL
231231
push_negotiation::Ptr{Cvoid} = C_NULL
232232
transport::Ptr{Cvoid} = C_NULL
233+
@static if LibGit2.VERSION >= v"1.2.0"
234+
remote_ready::Ptr{Cvoid} = C_NULL
235+
end
233236
payload::Any = nothing
234237
@static if LibGit2.VERSION >= v"0.99.0"
235238
resolve_url::Ptr{Cvoid} = C_NULL

stdlib/LibGit2_jll/src/LibGit2_jll.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ libgit2_path = ""
2121
if Sys.iswindows()
2222
const libgit2 = "libgit2.dll"
2323
elseif Sys.isapple()
24-
const libgit2 = "@rpath/libgit2.1.1.dylib"
24+
const libgit2 = "@rpath/libgit2.1.3.dylib"
2525
else
26-
const libgit2 = "libgit2.so.1.1"
26+
const libgit2 = "libgit2.so.1.3"
2727
end
2828

2929
function __init__()

0 commit comments

Comments
 (0)