upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/checkout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/ngit/sub_commands/checkout.rs')
-rw-r--r--src/bin/ngit/sub_commands/checkout.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bin/ngit/sub_commands/checkout.rs b/src/bin/ngit/sub_commands/checkout.rs
index 2fc9a09..19e39d0 100644
--- a/src/bin/ngit/sub_commands/checkout.rs
+++ b/src/bin/ngit/sub_commands/checkout.rs
@@ -28,7 +28,7 @@ use crate::{
28 repo_ref::get_repo_coordinates_when_remote_unknown, 28 repo_ref::get_repo_coordinates_when_remote_unknown,
29}; 29};
30 30
31pub async fn launch(id: &str) -> Result<()> { 31pub async fn launch(id: &str, offline: bool) -> Result<()> {
32 let event_id = parse_event_id(id)?; 32 let event_id = parse_event_id(id)?;
33 33
34 let git_repo = Repo::discover().context("failed to find a git repository")?; 34 let git_repo = Repo::discover().context("failed to find a git repository")?;
@@ -44,10 +44,12 @@ pub async fn launch(id: &str) -> Result<()> {
44 .ok() 44 .ok()
45 .flatten(); 45 .flatten();
46 46
47 if let Some((remote_name, _)) = &nostr_remote { 47 if !offline {
48 run_git_fetch(remote_name)?; 48 if let Some((remote_name, _)) = &nostr_remote {
49 } else { 49 run_git_fetch(remote_name)?;
50 fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; 50 } else {
51 fetching_with_report(git_repo_path, &client, &repo_coordinates).await?;
52 }
51 } 53 }
52 54
53 let repo_ref = get_repo_ref_from_cache(Some(git_repo_path), &repo_coordinates).await?; 55 let repo_ref = get_repo_ref_from_cache(Some(git_repo_path), &repo_coordinates).await?;