From ca22436c4a879effe15b6e5b4f5b8c99ff936289 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sat, 2 Mar 2024 00:43:48 +0800 Subject: [PATCH] git: enable `libgit2`'s OpenSSH feature --- Cargo.lock | 15 --------------- Cargo.toml | 6 +++++- cli/src/commands/git/mod.rs | 4 ++-- flake.nix | 6 ++---- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4422b99ffd..1f0cc7cc44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1829,7 +1829,6 @@ source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=8fd23a45f#8fd23a45f416 dependencies = [ "cc", "libc", - "libssh2-sys", "libz-sys", "openssl-sys", "pkg-config", @@ -1845,20 +1844,6 @@ dependencies = [ "libc", ] -[[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-sys" version = "1.1.18" diff --git a/Cargo.toml b/Cargo.toml index c1a3557632..39d90a149a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,11 @@ dirs = "5.0.1" either = "1.13.0" esl01-renderdag = "0.3.0" futures = "0.3.30" -git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "8fd23a45f" } +git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "8fd23a45f", default-features = false, features = [ + "https", + "ssh-openssh", + "vendored-libgit2", +] } gix = { version = "0.63.0", default-features = false, features = [ "index", "max-performance-safe", diff --git a/cli/src/commands/git/mod.rs b/cli/src/commands/git/mod.rs index 4b4fdd09f4..2b8acd53a5 100644 --- a/cli/src/commands/git/mod.rs +++ b/cli/src/commands/git/mod.rs @@ -80,8 +80,8 @@ fn map_git_error(err: git2::Error) -> CommandError { 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 8f3763fe23..8f23d41284 100644 --- a/flake.nix +++ b/flake.nix @@ -99,11 +99,10 @@ openssh ] ++ linuxNativeDeps; buildInputs = with pkgs; [ - openssl zstd libgit2 libssh2 + openssl zstd libgit2 openssh ] ++ darwinDeps; ZSTD_SYS_USE_PKG_CONFIG = "1"; - LIBSSH2_SYS_USE_PKG_CONFIG = "1"; RUSTFLAGS = pkgs.lib.optionalString pkgs.stdenv.isLinux "-C link-arg=-fuse-ld=mold"; NIX_JJ_GIT_HASH = self.rev or ""; CARGO_INCREMENTAL = "0"; @@ -153,7 +152,7 @@ ourRustVersion # Foreign dependencies - openssl zstd libgit2 libssh2 + openssl zstd libgit2 pkg-config # Additional tools recommended by contributing.md @@ -179,7 +178,6 @@ shellHook = '' export RUST_BACKTRACE=1 export ZSTD_SYS_USE_PKG_CONFIG=1 - export LIBSSH2_SYS_USE_PKG_CONFIG=1 export RUSTFLAGS="-Zthreads=0 ${rustLinkFlagsString}" '';