diff options
| -rw-r--r-- | src/git_remote_helper.rs | 10 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 16 | ||||
| -rw-r--r-- | test_utils/src/lib.rs | 2 | ||||
| -rw-r--r-- | tests/git_remote_helper.rs | 4 | ||||
| -rw-r--r-- | tests/list.rs | 8 |
5 files changed, 19 insertions, 21 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 |
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index 84ae8a9..56e9b17 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -1098,7 +1098,7 @@ pub fn get_proposal_branch_name_from_events( | |||
| 1098 | }) | 1098 | }) |
| 1099 | }) { | 1099 | }) { |
| 1100 | return Ok(format!( | 1100 | return Ok(format!( |
| 1101 | "prs/{}({})", | 1101 | "pr/{}({})", |
| 1102 | branch_name_in_event, | 1102 | branch_name_in_event, |
| 1103 | &event.id.to_hex().as_str()[..8], | 1103 | &event.id.to_hex().as_str()[..8], |
| 1104 | )); | 1104 | )); |
diff --git a/tests/git_remote_helper.rs b/tests/git_remote_helper.rs index cce8e42..a44b141 100644 --- a/tests/git_remote_helper.rs +++ b/tests/git_remote_helper.rs | |||
| @@ -2173,7 +2173,7 @@ mod push { | |||
| 2173 | r55.events = events.clone(); | 2173 | r55.events = events.clone(); |
| 2174 | 2174 | ||
| 2175 | let before = r55.events.iter().cloned().collect::<HashSet<Event>>(); | 2175 | let before = r55.events.iter().cloned().collect::<HashSet<Event>>(); |
| 2176 | let branch_name = "prs/my-new-proposal"; | 2176 | let branch_name = "pr/my-new-proposal"; |
| 2177 | 2177 | ||
| 2178 | let cli_tester_handle = std::thread::spawn(move || -> Result<String> { | 2178 | let cli_tester_handle = std::thread::spawn(move || -> Result<String> { |
| 2179 | let mut git_repo = clone_git_repo_with_nostr_url()?; | 2179 | let mut git_repo = clone_git_repo_with_nostr_url()?; |
| @@ -2250,7 +2250,7 @@ mod push { | |||
| 2250 | .find(|t| t.as_vec()[0].eq("branch-name")) | 2250 | .find(|t| t.as_vec()[0].eq("branch-name")) |
| 2251 | .unwrap() | 2251 | .unwrap() |
| 2252 | .as_vec()[1], | 2252 | .as_vec()[1], |
| 2253 | branch_name.replace("prs/", ""), | 2253 | branch_name.replace("pr/", ""), |
| 2254 | ); | 2254 | ); |
| 2255 | 2255 | ||
| 2256 | let second_patch = new_events | 2256 | let second_patch = new_events |
diff --git a/tests/list.rs b/tests/list.rs index ce90ee4..c145fa4 100644 --- a/tests/list.rs +++ b/tests/list.rs | |||
| @@ -197,7 +197,7 @@ mod when_main_branch_is_uptodate { | |||
| 197 | )?; | 197 | )?; |
| 198 | c.succeeds_with(0, false, None)?; | 198 | c.succeeds_with(0, false, None)?; |
| 199 | p.expect(&format!( | 199 | p.expect(&format!( |
| 200 | "checked out proposal as 'prs/{}(", | 200 | "checked out proposal as 'pr/{}(", |
| 201 | FEATURE_BRANCH_NAME_1, | 201 | FEATURE_BRANCH_NAME_1, |
| 202 | ))?; | 202 | ))?; |
| 203 | p.expect_end_eventually_with(")' branch\r\n")?; | 203 | p.expect_end_eventually_with(")' branch\r\n")?; |
| @@ -319,7 +319,7 @@ mod when_main_branch_is_uptodate { | |||
| 319 | )?; | 319 | )?; |
| 320 | c.succeeds_with(0, false, Some(0))?; | 320 | c.succeeds_with(0, false, Some(0))?; |
| 321 | p.expect(&format!( | 321 | p.expect(&format!( |
| 322 | "checked out proposal as 'prs/{}(", | 322 | "checked out proposal as 'pr/{}(", |
| 323 | FEATURE_BRANCH_NAME_3, | 323 | FEATURE_BRANCH_NAME_3, |
| 324 | ))?; | 324 | ))?; |
| 325 | p.expect_end_eventually_with(")' branch\r\n")?; | 325 | p.expect_end_eventually_with(")' branch\r\n")?; |
| @@ -526,7 +526,7 @@ mod when_main_branch_is_uptodate { | |||
| 526 | )?; | 526 | )?; |
| 527 | c.succeeds_with(0, false, Some(0))?; | 527 | c.succeeds_with(0, false, Some(0))?; |
| 528 | p.expect(&format!( | 528 | p.expect(&format!( |
| 529 | "checked out proposal as 'prs/{}(", | 529 | "checked out proposal as 'pr/{}(", |
| 530 | FEATURE_BRANCH_NAME_4, | 530 | FEATURE_BRANCH_NAME_4, |
| 531 | ))?; | 531 | ))?; |
| 532 | p.expect_end_eventually_with(")' branch\r\n")?; | 532 | p.expect_end_eventually_with(")' branch\r\n")?; |
| @@ -773,7 +773,7 @@ mod when_main_branch_is_uptodate { | |||
| 773 | )?; | 773 | )?; |
| 774 | c.succeeds_with(0, false, Some(0))?; | 774 | c.succeeds_with(0, false, Some(0))?; |
| 775 | p.expect(&format!( | 775 | p.expect(&format!( |
| 776 | "checked out proposal as 'prs/{}(", | 776 | "checked out proposal as 'pr/{}(", |
| 777 | FEATURE_BRANCH_NAME_1, | 777 | FEATURE_BRANCH_NAME_1, |
| 778 | ))?; | 778 | ))?; |
| 779 | p.expect_end_eventually_with(")' branch\r\n")?; | 779 | p.expect_end_eventually_with(")' branch\r\n")?; |