upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-10-31 09:32:38 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-10-31 09:33:18 +0000
commita0d147ba1f14468924f291c3bcf51b25329f4204 (patch)
treef0bf15767e69e309aa4b43f616060c1685c13dc3 /src/bin
parentae87aedae9696f4c855ac3dc47e61faec9d07c15 (diff)
fix(init): dont err when nostr remote and no ann
when the user has set a remote to a nostr url but hasn't initiated the repository on nostr - dont error but instead use the identifier in the remote
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/ngit/sub_commands/init.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index f7e1ee0..8f9ff0d 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -66,9 +66,13 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
66 None 66 None
67 }; 67 };
68 68
69 let repo_ref = if let Some(repo_coordinates) = repo_coordinates { 69 let repo_ref = if let Some(repo_coordinates) = repo_coordinates.clone() {
70 fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; 70 fetching_with_report(git_repo_path, &client, &repo_coordinates).await?;
71 Some(get_repo_ref_from_cache(git_repo_path, &repo_coordinates).await?) 71 if let Ok(repo_ref) = get_repo_ref_from_cache(git_repo_path, &repo_coordinates).await {
72 Some(repo_ref)
73 } else {
74 None
75 }
72 } else { 76 } else {
73 None 77 None
74 }; 78 };
@@ -95,6 +99,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
95 .with_prompt("name") 99 .with_prompt("name")
96 .with_default(if let Some(repo_ref) = &repo_ref { 100 .with_default(if let Some(repo_ref) = &repo_ref {
97 repo_ref.name.clone() 101 repo_ref.name.clone()
102 } else if let Some(repo_coordinates) = repo_coordinates.clone() {
103 if let Some(coordinate) = repo_coordinates.iter().next() {
104 coordinate.identifier.clone()
105 } else {
106 String::new()
107 }
98 } else { 108 } else {
99 String::new() 109 String::new()
100 }), 110 }),
@@ -108,6 +118,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
108 .with_prompt("identifier") 118 .with_prompt("identifier")
109 .with_default(if let Some(repo_ref) = &repo_ref { 119 .with_default(if let Some(repo_ref) = &repo_ref {
110 repo_ref.identifier.clone() 120 repo_ref.identifier.clone()
121 } else if let Some(repo_coordinates) = repo_coordinates.clone() {
122 if let Some(coordinate) = repo_coordinates.iter().next() {
123 coordinate.identifier.clone()
124 } else {
125 String::new()
126 }
111 } else { 127 } else {
112 let fallback = name 128 let fallback = name
113 .clone() 129 .clone()