diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-20 06:25:17 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-20 06:25:17 +0100 |
| commit | fedf5166f0c57db14b9e43747121e4b7845b63dd (patch) | |
| tree | 0bcbcc200239b75180931f6d5d6d76ee6ace1bf6 /src | |
| parent | 42b0bad048b64ef51f45da6a6988823e5a49da1d (diff) | |
feat: set proposal branch prefix to `pr/`
from `prs/`.
whilst plural reflects usage of `heads` and `tags` in git refs,
singular is shorter and more reflective of usage of branch prefixes
such as `feature/` `fix/`
Diffstat (limited to 'src')
| -rw-r--r-- | src/git_remote_helper.rs | 10 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 16 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 9b9b000..e55a2eb 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -233,7 +233,7 @@ async fn list( | |||
| 233 | .clone() | 233 | .clone() |
| 234 | }; | 234 | }; |
| 235 | 235 | ||
| 236 | state.retain(|k, _| !k.starts_with("refs/heads/prs/")); | 236 | state.retain(|k, _| !k.starts_with("refs/heads/pr/")); |
| 237 | 237 | ||
| 238 | let open_proposals = get_open_proposals(git_repo, repo_ref).await?; | 238 | let open_proposals = get_open_proposals(git_repo, repo_ref).await?; |
| 239 | let current_user = get_curent_user(git_repo)?; | 239 | let current_user = get_curent_user(git_repo)?; |
| @@ -447,7 +447,7 @@ async fn fetch( | |||
| 447 | 447 | ||
| 448 | let oids_from_git_servers = fetch_batch | 448 | let oids_from_git_servers = fetch_batch |
| 449 | .iter() | 449 | .iter() |
| 450 | .filter(|(refstr, _)| !refstr.contains("refs/heads/prs/")) | 450 | .filter(|(refstr, _)| !refstr.contains("refs/heads/pr/")) |
| 451 | .map(|(_, oid)| oid.clone()) | 451 | .map(|(_, oid)| oid.clone()) |
| 452 | .collect::<Vec<String>>(); | 452 | .collect::<Vec<String>>(); |
| 453 | 453 | ||
| @@ -488,7 +488,7 @@ async fn fetch( | |||
| 488 | ); | 488 | ); |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | fetch_batch.retain(|refstr, _| refstr.contains("refs/heads/prs/")); | 491 | fetch_batch.retain(|refstr, _| refstr.contains("refs/heads/pr/")); |
| 492 | 492 | ||
| 493 | if !fetch_batch.is_empty() { | 493 | if !fetch_batch.is_empty() { |
| 494 | let open_proposals = get_open_proposals(git_repo, repo_ref).await?; | 494 | let open_proposals = get_open_proposals(git_repo, repo_ref).await?; |
| @@ -580,13 +580,13 @@ async fn push( | |||
| 580 | 580 | ||
| 581 | let proposal_refspecs = refspecs | 581 | let proposal_refspecs = refspecs |
| 582 | .iter() | 582 | .iter() |
| 583 | .filter(|r| r.contains("refs/heads/prs/")) | 583 | .filter(|r| r.contains("refs/heads/pr/")) |
| 584 | .cloned() | 584 | .cloned() |
| 585 | .collect::<Vec<String>>(); | 585 | .collect::<Vec<String>>(); |
| 586 | 586 | ||
| 587 | let mut git_server_refspecs = refspecs | 587 | let mut git_server_refspecs = refspecs |
| 588 | .iter() | 588 | .iter() |
| 589 | .filter(|r| !r.contains("refs/heads/prs/")) | 589 | .filter(|r| !r.contains("refs/heads/pr/")) |
| 590 | .cloned() | 590 | .cloned() |
| 591 | .collect::<Vec<String>>(); | 591 | .collect::<Vec<String>>(); |
| 592 | 592 | ||
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index a005bd7..8369b10 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -648,7 +648,7 @@ pub async fn generate_cover_letter_and_patch_events( | |||
| 648 | vec![ | 648 | vec![ |
| 649 | Tag::custom( | 649 | Tag::custom( |
| 650 | nostr::TagKind::Custom(std::borrow::Cow::Borrowed("branch-name")), | 650 | nostr::TagKind::Custom(std::borrow::Cow::Borrowed("branch-name")), |
| 651 | vec![if let Some(branch_name) = branch_name.strip_prefix("prs/") { | 651 | vec![if let Some(branch_name) = branch_name.strip_prefix("pr/") { |
| 652 | branch_name.to_string() | 652 | branch_name.to_string() |
| 653 | } else { | 653 | } else { |
| 654 | branch_name | 654 | branch_name |
| @@ -691,13 +691,11 @@ pub async fn generate_cover_letter_and_patch_events( | |||
| 691 | && !branch_name.eq("origin/main") | 691 | && !branch_name.eq("origin/main") |
| 692 | && !branch_name.eq("origin/master") | 692 | && !branch_name.eq("origin/master") |
| 693 | { | 693 | { |
| 694 | Some( | 694 | Some(if let Some(branch_name) = branch_name.strip_prefix("pr/") { |
| 695 | if let Some(branch_name) = branch_name.strip_prefix("prs/") { | 695 | branch_name.to_string() |
| 696 | branch_name.to_string() | 696 | } else { |
| 697 | } else { | 697 | branch_name |
| 698 | branch_name | 698 | }) |
| 699 | }, | ||
| 700 | ) | ||
| 701 | } else { | 699 | } else { |
| 702 | None | 700 | None |
| 703 | } | 701 | } |
| @@ -793,7 +791,7 @@ pub struct CoverLetter { | |||
| 793 | impl CoverLetter { | 791 | impl CoverLetter { |
| 794 | pub fn get_branch_name(&self) -> Result<String> { | 792 | pub fn get_branch_name(&self) -> Result<String> { |
| 795 | Ok(format!( | 793 | Ok(format!( |
| 796 | "prs/{}({})", | 794 | "pr/{}({})", |
| 797 | self.branch_name, | 795 | self.branch_name, |
| 798 | &self | 796 | &self |
| 799 | .event_id | 797 | .event_id |