From dab099e9c279bf7d0c31e0743b71d2b659c6bfdd Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sat, 2 Mar 2024 00:43:48 +0800 Subject: [PATCH] git2: Use prerelease version with OpenSSH support --- Cargo.lock | 23 +++-------------------- Cargo.toml | 2 +- flake.nix | 9 +++++---- lib/src/git.rs | 7 ++++++- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af2d8974e6..99b811fb6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -931,8 +931,7 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=6ad326a9#6ad326a9d021a423564f78d6f2daa8ec3a0e8893" dependencies = [ "bitflags 2.5.0", "libc", @@ -1825,13 +1824,11 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +version = "0.17.0+1.8.0" +source = "git+https://github.com/bnjmnt4n/git2-rs.git?rev=6ad326a9#6ad326a9d021a423564f78d6f2daa8ec3a0e8893" dependencies = [ "cc", "libc", - "libssh2-sys", "libz-sys", "openssl-sys", "pkg-config", @@ -1848,20 +1845,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.16" diff --git a/Cargo.toml b/Cargo.toml index 0564c419a2..9acd3bc991 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ dirs = "5.0.1" either = "1.10.0" esl01-renderdag = "0.3.0" futures = "0.3.30" -git2 = "0.18.3" +git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "6ad326a9", default-features = false, features = ["https", "ssh-openssh", "vendored-libgit2"] } gix = { version = "0.61.0", default-features = false, features = [ "index", "max-performance-safe", diff --git a/flake.nix b/flake.nix index 5a0544268f..4fba5310ff 100644 --- a/flake.nix +++ b/flake.nix @@ -83,6 +83,9 @@ ]; cargoLock.lockFile = ./Cargo.lock; + cargoLock.outputHashes = { + "git2-0.18.3" = "sha256-Kfg3xWIAarAxeIo2wL30OFni7X4Thf9EzaXbFTWsehE="; + }; nativeBuildInputs = with pkgs; [ gzip installShellFiles @@ -94,11 +97,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 useMoldLinker "-C link-arg=-fuse-ld=mold"; NIX_JJ_GIT_HASH = self.rev or ""; CARGO_INCREMENTAL = "0"; @@ -161,7 +163,7 @@ }) # Foreign dependencies - openssl zstd libgit2 libssh2 + openssl zstd libgit2 pkg-config # Make sure rust-analyzer is present @@ -187,7 +189,6 @@ shellHook = '' export RUST_BACKTRACE=1 export ZSTD_SYS_USE_PKG_CONFIG=1 - export LIBSSH2_SYS_USE_PKG_CONFIG=1 '' + pkgs.lib.optionalString useMoldLinker '' export RUSTFLAGS="-C link-arg=-fuse-ld=mold" '' + darwinNextestHack; diff --git a/lib/src/git.rs b/lib/src/git.rs index ee3748c18b..63b5522e90 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -1149,7 +1149,12 @@ pub fn fetch( tracing::debug!("remote.prune"); remote.prune(None)?; tracing::debug!("remote.update_tips"); - remote.update_tips(None, false, git2::AutotagOption::Unspecified, None)?; + remote.update_tips( + None, + git2::RemoteUpdateFlags::empty(), + git2::AutotagOption::Unspecified, + None, + )?; // TODO: We could make it optional to get the default branch since we only care // about it on clone. let mut default_branch = None;