diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-08-05 11:38:09 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-08-06 16:00:58 +0100 |
| commit | 29f61ffdf155ea88b8d9aec23d28cf70baba577e (patch) | |
| tree | c235805b72d601ad8f9898f79c337fbb3d91b077 /src/bin | |
| parent | dee39c39116773fde22c4fe30a87d54d1d3658e2 (diff) | |
feat(send): custom ref for PR clone url
allow specifying ref for pushing PR to custom clone url
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 1 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 4552b91..f98e792 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -482,6 +482,7 @@ async fn generate_patches_or_pr_event_or_pr_updates( | |||
| 482 | root_proposal, | 482 | root_proposal, |
| 483 | &None, | 483 | &None, |
| 484 | &repo_grasp_clone_urls, | 484 | &repo_grasp_clone_urls, |
| 485 | None, | ||
| 485 | signer, | 486 | signer, |
| 486 | term, | 487 | term, |
| 487 | ) | 488 | ) |
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 | } |