From 5eb51bddb5fe3dbc08fd141cf50c62c73a0e1432 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 11 Sep 2024 23:29:24 +0200 Subject: [PATCH] apply bnjmnt4n's openssh patch See: https://github.com/martinvonz/jj/pull/3191 --- Cargo.lock | 21 ++------------------- Cargo.toml | 4 +++- cli/src/commands/git/mod.rs | 4 ++-- flake.nix | 9 +++++---- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4bde3c46f3..8d81f33cb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -925,8 +925,7 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=60e29ff0d#60e29ff0d84cdffd9f366455d32606e582a4c378" dependencies = [ "bitflags 2.6.0", "libc", @@ -1981,12 +1980,10 @@ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=60e29ff0d#60e29ff0d84cdffd9f366455d32606e582a4c378" dependencies = [ "cc", "libc", - "libssh2-sys", "libz-sys", "openssl-sys", "pkg-config", @@ -2003,20 +2000,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-sys" version = "1.1.19" diff --git a/Cargo.toml b/Cargo.toml index 55e4cf1190..554912039d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,9 @@ dunce = "1.0.5" either = "1.13.0" esl01-renderdag = "0.3.0" futures = "0.3.30" -git2 = { version = "0.19.0", features = [ +git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "60e29ff0d", 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/commands/git/mod.rs b/cli/src/commands/git/mod.rs index 6fa82a9b43..4c4b7ad959 100644 --- a/cli/src/commands/git/mod.rs +++ b/cli/src/commands/git/mod.rs @@ -90,8 +90,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 7089f58129..fd4f98e635 100644 --- a/flake.nix +++ b/flake.nix @@ -85,6 +85,9 @@ ]; cargoLock.lockFile = ./Cargo.lock; + cargoLock.outputHashes = { + "git2-0.19.0" = "sha256-fV8dFChGeDhb20bMyqefpAD5/+raQQ2sMdkEtlA1jaE="; + }; nativeBuildInputs = with pkgs; [ gzip installShellFiles @@ -96,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"; @@ -150,7 +152,7 @@ ourRustVersion # Foreign dependencies - openssl zstd libgit2 libssh2 + openssl zstd libgit2 pkg-config # Additional tools recommended by contributing.md @@ -176,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}" '';