diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-28 16:38:39 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-28 16:38:39 +0000 |
| commit | d4ef8cad0b95baa67e0f2803a7ec8601754a82a7 (patch) | |
| tree | bb085ca55e94940191e4e500cd655431a2f4cf57 /src | |
| parent | d0875a3a50b4a5e8ab087f7495ea10150d2c0e4f (diff) | |
fix: branch-name specified as main or master
branch-name should be ommitted or ignored if
patches created on main or master
instead it should be infered based on commit msg
Diffstat (limited to 'src')
| -rw-r--r-- | src/sub_commands/send.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 857bc60..5994f4f 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -441,10 +441,13 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 441 | // a change like this, or the removal of this tag will require the actual branch name to be tracked | 441 | // a change like this, or the removal of this tag will require the actual branch name to be tracked |
| 442 | // so pulling and pushing still work | 442 | // so pulling and pushing still work |
| 443 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { | 443 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { |
| 444 | vec![Tag::Generic( | 444 | if !branch_name.eq("main") && !branch_name.eq("master") { |
| 445 | TagKind::Custom("branch-name".to_string()), | 445 | vec![Tag::Generic( |
| 446 | vec![branch_name], | 446 | TagKind::Custom("branch-name".to_string()), |
| 447 | )] | 447 | vec![branch_name], |
| 448 | )] | ||
| 449 | } | ||
| 450 | else { vec![] } | ||
| 448 | } else { | 451 | } else { |
| 449 | vec![] | 452 | vec![] |
| 450 | }, | 453 | }, |
| @@ -475,7 +478,11 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 475 | }, | 478 | }, |
| 476 | if events.is_empty() { | 479 | if events.is_empty() { |
| 477 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { | 480 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { |
| 478 | Some(branch_name) | 481 | if !branch_name.eq("main") && !branch_name.eq("master") { |
| 482 | Some(branch_name) | ||
| 483 | } else { | ||
| 484 | None | ||
| 485 | } | ||
| 479 | } else { | 486 | } else { |
| 480 | None | 487 | None |
| 481 | } | 488 | } |
| @@ -586,7 +593,16 @@ pub fn event_to_cover_letter(event: &nostr::Event) -> Result<CoverLetter> { | |||
| 586 | title: title.clone(), | 593 | title: title.clone(), |
| 587 | description, | 594 | description, |
| 588 | // TODO should this be prefixed by format!("{}-"e.id.to_string()[..5]?) | 595 | // TODO should this be prefixed by format!("{}-"e.id.to_string()[..5]?) |
| 589 | branch_name: if let Ok(name) = tag_value(event, "branch-name") { | 596 | branch_name: if let Ok(name) = match tag_value(event, "branch-name") { |
| 597 | Ok(name) => { | ||
| 598 | if !name.eq("main") && !name.eq("master") { | ||
| 599 | Ok(name) | ||
| 600 | } else { | ||
| 601 | Err(()) | ||
| 602 | } | ||
| 603 | } | ||
| 604 | _ => Err(()), | ||
| 605 | } { | ||
| 590 | name | 606 | name |
| 591 | } else { | 607 | } else { |
| 592 | let s = title | 608 | let s = title |