diff --git a/Cargo.lock b/Cargo.lock index 5802eb5..b7c065f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1223,11 +1223,26 @@ checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", + "libssh2-sys", "libz-sys", "openssl-sys", "pkg-config", ] +[[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.9" diff --git a/cuddle_cli/Cargo.toml b/cuddle_cli/Cargo.toml index 0c46579..9dd8f91 100644 --- a/cuddle_cli/Cargo.toml +++ b/cuddle_cli/Cargo.toml @@ -18,6 +18,7 @@ walkdir = "2.3.2" git2 = { version = "0.17.2", default-features = false, features = [ "vendored-libgit2", "vendored-openssl", + "ssh", ] } clap = { version = "4.3.4", features = ["env", "string"] } envconfig = "0.10.0" diff --git a/cuddle_cli/src/context.rs b/cuddle_cli/src/context.rs index 9db7df5..de551da 100644 --- a/cuddle_cli/src/context.rs +++ b/cuddle_cli/src/context.rs @@ -1,11 +1,15 @@ use std::{ env::{self, current_dir}, ffi::OsStr, + io::Write, path::{Path, PathBuf}, sync::{Arc, Mutex}, }; -use git2::{build::RepoBuilder, FetchOptions, RemoteCallbacks}; +use git2::{ + build::{CheckoutBuilder, RepoBuilder}, + FetchOptions, RemoteCallbacks, +}; use crate::{ config::{CuddleConfig, CuddleFetchPolicy}, @@ -128,8 +132,10 @@ fn pull_parent_cuddle_into_local( let mut fo = FetchOptions::new(); fo.remote_callbacks(rc); + let co = CheckoutBuilder::new(); RepoBuilder::new() .fetch_options(fo) + .with_checkout(co) .clone(&parent_cuddle, &destination)?; log::debug!(parent_cuddle=log::as_display!(parent_cuddle); "pulled repository");