From b0a2d3a1d704f93d5ad62acf4a442eb62561cc12 Mon Sep 17 00:00:00 2001 From: Jean-Marc Le Roux Date: Mon, 16 Jul 2018 23:07:18 +0200 Subject: [PATCH 1/2] Add the ssh_key_from_memory optional feature. --- Cargo.toml | 1 + libgit2-sys/Cargo.toml | 1 + libgit2-sys/build.rs | 3 +++ 3 files changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 981a997072..d121b8bdc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ default = ["ssh", "https", "curl"] ssh = ["libgit2-sys/ssh"] https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] curl = ["libgit2-sys/curl"] +ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] [workspace] members = ["systest", "git2-curl"] diff --git a/libgit2-sys/Cargo.toml b/libgit2-sys/Cargo.toml index 67e643aa62..54ed78076f 100644 --- a/libgit2-sys/Cargo.toml +++ b/libgit2-sys/Cargo.toml @@ -33,3 +33,4 @@ openssl-sys = { version = "0.9", optional = true } ssh = ["libssh2-sys"] https = ["openssl-sys"] curl = ["curl-sys"] +ssh_key_from_memory = [] diff --git a/libgit2-sys/build.rs b/libgit2-sys/build.rs index 1e92dbcdc6..b765ece455 100644 --- a/libgit2-sys/build.rs +++ b/libgit2-sys/build.rs @@ -48,6 +48,9 @@ fn main() { let msvc = target.contains("msvc"); let mut cfg = cmake::Config::new("libgit2"); + #[cfg(feature = "ssh_key_from_memory")] + cfg.define("GIT_SSH_MEMORY_CREDENTIALS", "1"); + if msvc { // libgit2 passes the /GL flag to enable whole program optimization, but // this requires that the /LTCG flag is passed to the linker later on, From 7c1615d65a68ccbb7b9496428f1c43b60fe3a0ca Mon Sep 17 00:00:00 2001 From: Jean-Marc Le Roux Date: Thu, 26 Jul 2018 19:53:59 +0200 Subject: [PATCH 2/2] Enable the ssh_key_from_memory feature by default. Users with older versions of libssh can still disable it if needed. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d121b8bdc7..447468670e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ tempdir = "0.3" [features] unstable = [] -default = ["ssh", "https", "curl"] +default = ["ssh", "https", "curl", "ssh_key_from_memory"] ssh = ["libgit2-sys/ssh"] https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] curl = ["libgit2-sys/curl"]