From d816a236bee58cde5bbd86772372a1f61fef4aee Mon Sep 17 00:00:00 2001 From: Benjamin Tan <benjamin@dev.ofcr.se> Date: Sat, 2 Mar 2024 00:43:48 +0800 Subject: [PATCH 1/2] git: vendor custom prerelease version of `libgit2` --- Cargo.lock | 10 ++++------ Cargo.toml | 2 +- flake.nix | 3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 821be41f8a..e7e289bd25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1109,9 +1109,8 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +version = "0.20.0" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=8614b5d#8614b5de5245b06caa8b6e569e8c5bde06ab3e51" dependencies = [ "bitflags 2.6.0", "libc", @@ -2395,9 +2394,8 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +version = "0.18.0+1.9.0" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=8614b5d#8614b5de5245b06caa8b6e569e8c5bde06ab3e51" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index 9852972d3c..e713f261cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ dirs = "5.0.1" dunce = "1.0.5" either = "1.13.0" futures = "0.3.31" -git2 = { version = "0.19.0", features = [ +git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "8614b5d", features = [ # Do *not* disable this feature even if you'd like dynamic linking. Instead, # set the environment variable `LIBGIT2_NO_VENDOR=1` if dynamic linking must # be used (this will override the Cargo feature), and allow static linking diff --git a/flake.nix b/flake.nix index db22914c01..eb31eec209 100644 --- a/flake.nix +++ b/flake.nix @@ -118,6 +118,9 @@ ]; cargoLock.lockFile = ./Cargo.lock; + cargoLock.outputHashes = { + "git2-0.20.0" = "sha256-38oCCouFCwmfaORKMHKsKslaf7xcqSsrBOFWX9/hwIw="; + }; nativeBuildInputs = nativeBuildInputs ++ [pkgs.installShellFiles]; inherit buildInputs nativeCheckInputs; From 8a7f24424ecd185809cc7cc7b87af1e2fcbc8005 Mon Sep 17 00:00:00 2001 From: Benjamin Tan <benjamin@dev.ofcr.se> Date: Sat, 2 Mar 2024 00:43:48 +0800 Subject: [PATCH 2/2] git: enable `libgit2`'s OpenSSH feature --- Cargo.lock | 15 --------------- Cargo.toml | 4 +++- cli/src/command_error.rs | 4 ++-- flake.nix | 3 +-- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e7e289bd25..df81bfe34e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2399,7 +2399,6 @@ source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=8614b5d#8614b5de5245b0 dependencies = [ "cc", "libc", - "libssh2-sys", "libz-sys", "openssl-sys", "pkg-config", @@ -2416,20 +2415,6 @@ dependencies = [ "redox_syscall", ] -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-ng-sys" version = "1.1.16" diff --git a/Cargo.toml b/Cargo.toml index e713f261cf..aabcdc663b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,9 @@ dirs = "5.0.1" dunce = "1.0.5" either = "1.13.0" futures = "0.3.31" -git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "8614b5d", features = [ +git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "8614b5d", default-features = false, features = [ + "https", + "ssh-openssh", # Do *not* disable this feature even if you'd like dynamic linking. Instead, # set the environment variable `LIBGIT2_NO_VENDOR=1` if dynamic linking must # be used (this will override the Cargo feature), and allow static linking diff --git a/cli/src/command_error.rs b/cli/src/command_error.rs index f3e57cbf1d..ce9e754c33 100644 --- a/cli/src/command_error.rs +++ b/cli/src/command_error.rs @@ -605,8 +605,8 @@ jj currently does not support partial clones. To use jj with this repository, tr successfully load certificates. Try setting it to the path of a directory that \ contains a `.ssh` directory." } else { - "Jujutsu uses libssh2, which doesn't respect ~/.ssh/config. Does `ssh -F \ - /dev/null` to the host work?" + "There was an error creating an SSH connection. Does `ssh -F /dev/null` to the \ + host work?" }; user_error_with_hint(err, hint) diff --git a/flake.nix b/flake.nix index eb31eec209..76483984da 100644 --- a/flake.nix +++ b/flake.nix @@ -77,7 +77,7 @@ [ openssl libgit2 - libssh2 + openssh ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security @@ -95,7 +95,6 @@ ]; env = { - LIBSSH2_SYS_USE_PKG_CONFIG = "1"; RUST_BACKTRACE = 1; }; in {