diff --git a/' b/' deleted file mode 100644 index 99c487c..0000000 --- a/' +++ /dev/null @@ -1,6 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -#[serde(tag = "apiVersion")] -pub enum Schema {} - diff --git a/crates/octopush_cli/src/commands/execute.rs b/crates/octopush_cli/src/commands/execute.rs index bbb20ff..0160dc2 100644 --- a/crates/octopush_cli/src/commands/execute.rs +++ b/crates/octopush_cli/src/commands/execute.rs @@ -40,6 +40,7 @@ pub async fn execute_subcommand(args: &ArgMatches) -> eyre::Result<()> { } => { tracing::debug!(name, "running action"); + tracing::info!("fetching repos"); let mut repo_clones = Vec::with_capacity(select.repositories.len()); for repo in select.repositories { let gp = service_register.git_provider.clone(); diff --git a/crates/octopush_core/src/git/github.rs b/crates/octopush_core/src/git/github.rs index 6ccc959..50e6464 100644 --- a/crates/octopush_core/src/git/github.rs +++ b/crates/octopush_core/src/git/github.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + use git2::{Cred, RemoteCallbacks}; use crate::storage::DynStorageEngine; @@ -16,11 +18,12 @@ impl GitHubGitProvider { #[async_trait::async_trait] impl GitProvider for GitHubGitProvider { - async fn clone_from_url(&self, url: String) -> eyre::Result<()> { + async fn clone_from_url(&self, url: String) -> eyre::Result { tracing::debug!(url, "allocating dir"); let dir = self.storage_engine.allocate_dir().await?; - tokio::task::spawn_blocking(move || { + let dirpath = dir.clone().path(); + let _ = tokio::task::spawn_blocking(move || { let mut callbacks = RemoteCallbacks::new(); callbacks.credentials(|url, username_from_url, _allowed_types| { tracing::debug!(username_from_url, url, "pulling key from ssh-agent"); @@ -33,17 +36,17 @@ impl GitProvider for GitHubGitProvider { let mut builder = git2::build::RepoBuilder::new(); builder.fetch_options(fo); - let path = dir.path(); - tracing::debug!( url, - path = path.as_os_str().to_string_lossy().to_string(), + path = dirpath.as_os_str().to_string_lossy().to_string(), "clone git repo" ); - builder.clone(url.as_str(), path.as_path()) + builder.clone(url.as_str(), dirpath.as_path()) }) .await??; - Ok(()) + tracing::debug!("done pulling repo"); + + Ok(dir.path()) } } diff --git a/crates/octopush_core/src/git/mod.rs b/crates/octopush_core/src/git/mod.rs index 385df10..b6b2cb7 100644 --- a/crates/octopush_core/src/git/mod.rs +++ b/crates/octopush_core/src/git/mod.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{path::PathBuf, sync::Arc}; use async_trait::async_trait; @@ -6,7 +6,7 @@ pub mod github; #[async_trait] pub trait GitProvider { - async fn clone_from_url(&self, url: String) -> eyre::Result<()>; + async fn clone_from_url(&self, url: String) -> eyre::Result; } pub type DynGitProvider = Arc;