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/lib | |
| 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/lib')
| -rw-r--r-- | src/lib/push.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/push.rs b/src/lib/push.rs index 4c2d8f1..c202397 100644 --- a/src/lib/push.rs +++ b/src/lib/push.rs | |||
| @@ -330,6 +330,7 @@ pub async fn push_refs_and_generate_pr_or_pr_update_event( | |||
| 330 | root_proposal: Option<&Event>, | 330 | root_proposal: Option<&Event>, |
| 331 | title_description_overide: &Option<(String, String)>, | 331 | title_description_overide: &Option<(String, String)>, |
| 332 | servers: &[String], | 332 | servers: &[String], |
| 333 | git_ref: Option<String>, | ||
| 333 | signer: &Arc<dyn NostrSigner>, | 334 | signer: &Arc<dyn NostrSigner>, |
| 334 | term: &Term, | 335 | term: &Term, |
| 335 | ) -> Result<(Option<Vec<Event>>, Vec<(String, Result<()>)>)> { | 336 | ) -> Result<(Option<Vec<Event>>, Vec<(String, Result<()>)>)> { |
| @@ -352,7 +353,12 @@ pub async fn push_refs_and_generate_pr_or_pr_update_event( | |||
| 352 | )? | 353 | )? |
| 353 | }; | 354 | }; |
| 354 | 355 | ||
| 355 | let refspec = format!("{}:refs/nostr/{}", tip, draft_pr_event.id()); | 356 | let git_ref_used = git_ref |
| 357 | .clone() | ||
| 358 | .unwrap_or("refs/nostr/<event-id>".to_string()) | ||
| 359 | .replace("<event-id>", &draft_pr_event.id().to_string()); | ||
| 360 | |||
| 361 | let refspec = format!("{tip}:{git_ref_used}"); | ||
| 356 | 362 | ||
| 357 | if let Err(error) = push_to_remote_url(git_repo, clone_url, &[refspec], term) { | 363 | if let Err(error) = push_to_remote_url(git_repo, clone_url, &[refspec], term) { |
| 358 | term.write_line( | 364 | term.write_line( |