upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/sub_commands
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-03 11:01:14 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-03 15:22:56 +0100
commita0fdc17426afa0e55a2a3b733983bab763226e5a (patch)
treeea0f8f5e51d84ecca543692255657c5ebc7869eb /src/sub_commands
parent36763dc0d821425e088adefd16dc7c4bf3b30f3b (diff)
feat(init): https as default clone url protocol
so clone urls align to fetch rather than push. see discussion here: nostr:nevent1qvzqqqqx25pzpp59a0hkv5ecm45nrckvmu7pnk0sukssvly33u3wwzquy4v037hcqyxhwumn8ghj7mn0wvhxcmmvqqs2tdha5ymadffrkdprachsz6gsgsy6kc8gkntgq750mfn7u3aeu3g7xt8k9
Diffstat (limited to 'src/sub_commands')
-rw-r--r--src/sub_commands/init.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs
index 4958536..5b7e03d 100644
--- a/src/sub_commands/init.rs
+++ b/src/sub_commands/init.rs
@@ -13,7 +13,7 @@ use crate::{
13 cli::Cli, 13 cli::Cli,
14 cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, 14 cli_interactor::{Interactor, InteractorPrompt, PromptInputParms},
15 client::{fetching_with_report, get_repo_ref_from_cache, Connect}, 15 client::{fetching_with_report, get_repo_ref_from_cache, Connect},
16 git::{Repo, RepoActions}, 16 git::{convert_clone_url_to_https, Repo, RepoActions},
17 login, 17 login,
18 repo_ref::{ 18 repo_ref::{
19 extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, 19 extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml,
@@ -159,11 +159,16 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
159 Interactor::default() 159 Interactor::default()
160 .input( 160 .input(
161 PromptInputParms::default() 161 PromptInputParms::default()
162 .with_prompt("clone url") 162 .with_prompt("clone url (for fetch)")
163 .with_default(if let Some(repo_ref) = &repo_ref { 163 .with_default(if let Some(repo_ref) = &repo_ref {
164 repo_ref.git_server.clone().join(" ") 164 repo_ref.git_server.clone().join(" ")
165 } else if let Ok(git_repo) = git_repo.get_origin_url() { 165 } else if let Ok(url) = git_repo.get_origin_url() {
166 git_repo 166 if let Ok(fetch_url) = convert_clone_url_to_https(&url) {
167 fetch_url
168 } else {
169 // local repo or custom protocol
170 url
171 }
167 } else { 172 } else {
168 String::new() 173 String::new()
169 }), 174 }),