Skip to content

Commit

Permalink
Upgrade libgit2 to 1.4.3 (#4930)
Browse files Browse the repository at this point in the history
* Upgrade libgit2 to 1.4.3

* [LibGit2] Require Julia v1.9

* [LibGit2] Remove `CFLAGS` setting which shouldn't be needed anymore

Co-authored-by: Mosè Giordano <[email protected]>
  • Loading branch information
fxcoudert and giordano authored May 21, 2022
1 parent b4364b6 commit 3279feb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
8 changes: 3 additions & 5 deletions L/LibGit2/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using BinaryBuilder

name = "LibGit2"
version = v"1.3.0"
version = v"1.4.3"

# Collection of sources required to build libgit2
sources = [
GitSource("https://github.com/libgit2/libgit2.git",
"b7bad55e4bb0a285b073ba5e02b01d3f522fc95d"),
"465bbf88ea939a965fbcbade72870c61f815e457"),
DirectorySource("./bundled"),
]

Expand Down Expand Up @@ -38,7 +38,6 @@ elif [[ ${target} == *linux* ]] || [[ ${target} == *freebsd* ]]; then
# If we're on Linux or FreeBSD, explicitly ask for mbedTLS instead of OpenSSL
BUILD_FLAGS+=(-DUSE_HTTPS=mbedTLS -DSHA1_BACKEND=CollisionDetection -DCMAKE_INSTALL_RPATH="\$ORIGIN")
fi
export CFLAGS="-I${prefix}/include"
mkdir build && cd build
Expand All @@ -63,5 +62,4 @@ dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.8")

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.9")
23 changes: 13 additions & 10 deletions L/LibGit2/bundled/patches/libgit2-hostkey.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index 471c3273ed..32189d0979 100644
index 89f085230..b8bdca61a 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -525,6 +525,7 @@ static int _git_ssh_setup_conn(
@@ -467,6 +467,7 @@ static int _git_ssh_setup_conn(
git_credential *cred = NULL;
LIBSSH2_SESSION *session=NULL;
LIBSSH2_CHANNEL *channel=NULL;
+ char *host_and_port;

t->current_stream = NULL;

@@ -636,7 +637,15 @@ post_extract:
@@ -567,10 +568,18 @@ static int _git_ssh_setup_conn(

cert_ptr = &cert;

- error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, urldata.host, t->owner->message_cb_payload);
+ if (atoi(urldata.port) == SSH_DEFAULT_PORT) {
+ host_and_port = urldata.host;
+ if (atoi(s->url.port) == SSH_DEFAULT_PORT) {
+ host_and_port = s->url.host;
+ } else {
+ size_t n = strlen(urldata.host) + strlen(urldata.port) + 2;
+ size_t n = strlen(s->url.host) + strlen(s->url.port) + 2;
+ host_and_port = alloca(n);
+ sprintf(host_and_port, "%s:%s", urldata.host, urldata.port);
+ sprintf(host_and_port, "%s:%s", s->url.host, s->url.port);
+ }
+
+ error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, host_and_port, t->owner->message_cb_payload);
error = t->owner->connect_opts.callbacks.certificate_check(
(git_cert *)cert_ptr,
0,
- s->url.host,
+ host_and_port,
t->owner->connect_opts.callbacks.payload);

if (error < 0 && error != GIT_PASSTHROUGH) {
if (!git_error_last())

0 comments on commit 3279feb

Please sign in to comment.