upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/send.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-08-05 11:38:09 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-08-06 16:00:58 +0100
commit29f61ffdf155ea88b8d9aec23d28cf70baba577e (patch)
treec235805b72d601ad8f9898f79c337fbb3d91b077 /src/bin/ngit/sub_commands/send.rs
parentdee39c39116773fde22c4fe30a87d54d1d3658e2 (diff)
feat(send): custom ref for PR clone url
allow specifying ref for pushing PR to custom clone url
Diffstat (limited to 'src/bin/ngit/sub_commands/send.rs')
-rw-r--r--src/bin/ngit/sub_commands/send.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs
index 69ad1e6..609812b 100644
--- a/src/bin/ngit/sub_commands/send.rs
+++ b/src/bin/ngit/sub_commands/send.rs
@@ -208,6 +208,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re
208 } 208 }
209 let mut to_try = repo_grasp_clone_urls.clone(); 209 let mut to_try = repo_grasp_clone_urls.clone();
210 let mut tried = vec![]; 210 let mut tried = vec![];
211 let mut git_ref = None;
211 loop { 212 loop {
212 let (events, _server_responses) = push_refs_and_generate_pr_or_pr_update_event( 213 let (events, _server_responses) = push_refs_and_generate_pr_or_pr_update_event(
213 &git_repo, 214 &git_repo,
@@ -217,6 +218,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re
217 root_proposal.as_ref(), 218 root_proposal.as_ref(),
218 &cover_letter_title_description, 219 &cover_letter_title_description,
219 &repo_grasp_clone_urls, 220 &repo_grasp_clone_urls,
221 git_ref.clone(),
220 &signer, 222 &signer,
221 &console::Term::stdout(), 223 &console::Term::stdout(),
222 ) 224 )
@@ -235,7 +237,17 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re
235 .clone(); 237 .clone();
236 if CloneUrl::from_str(&clone_url).is_ok() { 238 if CloneUrl::from_str(&clone_url).is_ok() {
237 to_try.push(clone_url); 239 to_try.push(clone_url);
238 // TODO customise ref to push 240 let mut git_ref_or_branch_name = Interactor::default()
241 .input(
242 PromptInputParms::default()
243 .with_prompt("ref / branch name")
244 .with_default(git_ref.unwrap_or("refs/nostr/<event-id>".to_string())),
245 )?
246 .clone();
247 if !git_ref_or_branch_name.starts_with("refs/") {
248 git_ref_or_branch_name = format!("refs/heads/{git_ref_or_branch_name}");
249 }
250 git_ref = Some(git_ref_or_branch_name);
239 } else { 251 } else {
240 println!("invalid clone url"); 252 println!("invalid clone url");
241 } 253 }