diff options
Diffstat (limited to 'src/bin/ngit/sub_commands/fetch.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/fetch.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/bin/ngit/sub_commands/fetch.rs b/src/bin/ngit/sub_commands/fetch.rs index b1e83c5..c69f1c5 100644 --- a/src/bin/ngit/sub_commands/fetch.rs +++ b/src/bin/ngit/sub_commands/fetch.rs | |||
| @@ -4,13 +4,9 @@ use anyhow::{Context, Result}; | |||
| 4 | use clap; | 4 | use clap; |
| 5 | use nostr::nips::nip01::Coordinate; | 5 | use nostr::nips::nip01::Coordinate; |
| 6 | 6 | ||
| 7 | #[cfg(not(test))] | ||
| 8 | use crate::client::Client; | ||
| 9 | #[cfg(test)] | ||
| 10 | use crate::client::MockConnect; | ||
| 11 | use crate::{ | 7 | use crate::{ |
| 12 | cli::Cli, | 8 | cli::Cli, |
| 13 | client::{fetching_with_report, Connect}, | 9 | client::{fetching_with_report, Client, Connect}, |
| 14 | git::{Repo, RepoActions}, | 10 | git::{Repo, RepoActions}, |
| 15 | repo_ref::get_repo_coordinates, | 11 | repo_ref::get_repo_coordinates, |
| 16 | }; | 12 | }; |
| @@ -25,10 +21,7 @@ pub struct SubCommandArgs { | |||
| 25 | pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { | 21 | pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { |
| 26 | let _ = args; | 22 | let _ = args; |
| 27 | let git_repo = Repo::discover().context("cannot find a git repository")?; | 23 | let git_repo = Repo::discover().context("cannot find a git repository")?; |
| 28 | #[cfg(not(test))] | ||
| 29 | let client = Client::default(); | 24 | let client = Client::default(); |
| 30 | #[cfg(test)] | ||
| 31 | let client = <MockConnect as std::default::Default>::default(); | ||
| 32 | let repo_coordinates = if command_args.repo.is_empty() { | 25 | let repo_coordinates = if command_args.repo.is_empty() { |
| 33 | get_repo_coordinates(&git_repo, &client).await? | 26 | get_repo_coordinates(&git_repo, &client).await? |
| 34 | } else { | 27 | } else { |