diff options
Diffstat (limited to 'src/sub_commands')
| -rw-r--r-- | src/sub_commands/list.rs | 2 | ||||
| -rw-r--r-- | src/sub_commands/pull.rs | 2 | ||||
| -rw-r--r-- | src/sub_commands/push.rs | 2 | ||||
| -rw-r--r-- | src/sub_commands/send.rs | 29 |
4 files changed, 20 insertions, 15 deletions
diff --git a/src/sub_commands/list.rs b/src/sub_commands/list.rs index ad5a28d..102c3bd 100644 --- a/src/sub_commands/list.rs +++ b/src/sub_commands/list.rs | |||
| @@ -274,7 +274,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 274 | }; | 274 | }; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | let local_branch_tip = git_repo.get_tip_of_local_branch(&cover_letter.branch_name)?; | 277 | let local_branch_tip = git_repo.get_tip_of_branch(&cover_letter.branch_name)?; |
| 278 | 278 | ||
| 279 | // up-to-date | 279 | // up-to-date |
| 280 | if proposal_tip.eq(&local_branch_tip) { | 280 | if proposal_tip.eq(&local_branch_tip) { |
diff --git a/src/sub_commands/pull.rs b/src/sub_commands/pull.rs index daae37f..716e6c5 100644 --- a/src/sub_commands/pull.rs +++ b/src/sub_commands/pull.rs | |||
| @@ -60,7 +60,7 @@ pub async fn launch() -> Result<()> { | |||
| 60 | get_most_recent_patch_with_ancestors(commit_events.clone()) | 60 | get_most_recent_patch_with_ancestors(commit_events.clone()) |
| 61 | .context("cannot get most recent patch for proposal")?; | 61 | .context("cannot get most recent patch for proposal")?; |
| 62 | 62 | ||
| 63 | let local_branch_tip = git_repo.get_tip_of_local_branch(&branch_name)?; | 63 | let local_branch_tip = git_repo.get_tip_of_branch(&branch_name)?; |
| 64 | 64 | ||
| 65 | let (main_branch_name, master_tip) = git_repo.get_main_or_master_branch()?; | 65 | let (main_branch_name, master_tip) = git_repo.get_main_or_master_branch()?; |
| 66 | 66 | ||
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index fdaab8e..651b250 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs | |||
| @@ -75,7 +75,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 75 | let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events) | 75 | let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events) |
| 76 | .context("cannot get most recent patch for proposal")?; | 76 | .context("cannot get most recent patch for proposal")?; |
| 77 | 77 | ||
| 78 | let branch_tip = git_repo.get_tip_of_local_branch(&branch_name)?; | 78 | let branch_tip = git_repo.get_tip_of_branch(&branch_name)?; |
| 79 | 79 | ||
| 80 | let most_recent_patch_commit_id = str_to_sha1( | 80 | let most_recent_patch_commit_id = str_to_sha1( |
| 81 | &get_commit_id_from_patch( | 81 | &get_commit_id_from_patch( |
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 9b44cc3..81cecd8 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -53,13 +53,13 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 53 | println!("creating proposal revision for: {id}"); | 53 | println!("creating proposal revision for: {id}"); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | let (main_branch_name, main_tip) = git_repo | ||
| 57 | .get_main_or_master_branch() | ||
| 58 | .context("the default branches (main or master) do not exist")?; | ||
| 59 | |||
| 56 | let mut commits: Vec<Sha1Hash> = { | 60 | let mut commits: Vec<Sha1Hash> = { |
| 57 | if args.since_or_range.is_empty() { | 61 | if args.since_or_range.is_empty() { |
| 58 | let branch_name = git_repo.get_checked_out_branch_name()?; | 62 | let branch_name = git_repo.get_checked_out_branch_name()?; |
| 59 | let (main_branch_name, main_tip) = git_repo | ||
| 60 | .get_main_or_master_branch() | ||
| 61 | .context("the default branches (main or master) do not exist")?; | ||
| 62 | |||
| 63 | let proposed_commits = if branch_name.eq(main_branch_name) { | 63 | let proposed_commits = if branch_name.eq(main_branch_name) { |
| 64 | vec![main_tip] | 64 | vec![main_tip] |
| 65 | } else { | 65 | } else { |
| @@ -88,9 +88,6 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 88 | ); | 88 | ); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | let (main_branch_name, main_tip) = git_repo | ||
| 92 | .get_main_or_master_branch() | ||
| 93 | .context("the default branches (main or master) do not exist")?; | ||
| 94 | let (first_commit_ahead, behind) = | 91 | let (first_commit_ahead, behind) = |
| 95 | git_repo.get_commits_ahead_behind(&main_tip, commits.last().context("no commits")?)?; | 92 | git_repo.get_commits_ahead_behind(&main_tip, commits.last().context("no commits")?)?; |
| 96 | 93 | ||
| @@ -385,7 +382,7 @@ fn choose_commits(git_repo: &Repo, proposed_commits: Vec<Sha1Hash>) -> Result<Ve | |||
| 385 | proposed_commits | 382 | proposed_commits |
| 386 | }; | 383 | }; |
| 387 | 384 | ||
| 388 | let tip_of_head = git_repo.get_tip_of_local_branch(&git_repo.get_checked_out_branch_name()?)?; | 385 | let tip_of_head = git_repo.get_tip_of_branch(&git_repo.get_checked_out_branch_name()?)?; |
| 389 | let most_recent_commit = proposed_commits.first().unwrap_or(&tip_of_head); | 386 | let most_recent_commit = proposed_commits.first().unwrap_or(&tip_of_head); |
| 390 | 387 | ||
| 391 | let mut last_15_commits = vec![*most_recent_commit]; | 388 | let mut last_15_commits = vec![*most_recent_commit]; |
| @@ -571,7 +568,11 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 571 | // a change like this, or the removal of this tag will require the actual branch name to be tracked | 568 | // a change like this, or the removal of this tag will require the actual branch name to be tracked |
| 572 | // so pulling and pushing still work | 569 | // so pulling and pushing still work |
| 573 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { | 570 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { |
| 574 | if !branch_name.eq("main") && !branch_name.eq("master") { | 571 | if !branch_name.eq("main") |
| 572 | && !branch_name.eq("master") | ||
| 573 | && !branch_name.eq("origin/main") | ||
| 574 | && !branch_name.eq("origin/master") | ||
| 575 | { | ||
| 575 | vec![Tag::Generic( | 576 | vec![Tag::Generic( |
| 576 | TagKind::Custom("branch-name".to_string()), | 577 | TagKind::Custom("branch-name".to_string()), |
| 577 | vec![branch_name], | 578 | vec![branch_name], |
| @@ -608,7 +609,11 @@ pub fn generate_cover_letter_and_patch_events( | |||
| 608 | }, | 609 | }, |
| 609 | if events.is_empty() { | 610 | if events.is_empty() { |
| 610 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { | 611 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { |
| 611 | if !branch_name.eq("main") && !branch_name.eq("master") { | 612 | if !branch_name.eq("main") |
| 613 | && !branch_name.eq("master") | ||
| 614 | && !branch_name.eq("origin/main") | ||
| 615 | && !branch_name.eq("origin/master") | ||
| 616 | { | ||
| 612 | Some(branch_name) | 617 | Some(branch_name) |
| 613 | } else { | 618 | } else { |
| 614 | None | 619 | None |
| @@ -915,7 +920,7 @@ fn identify_ahead_behind( | |||
| 915 | Some(name) => ( | 920 | Some(name) => ( |
| 916 | name.to_string(), | 921 | name.to_string(), |
| 917 | git_repo | 922 | git_repo |
| 918 | .get_tip_of_local_branch(name) | 923 | .get_tip_of_branch(name) |
| 919 | .context(format!("cannot find from_branch '{name}'"))?, | 924 | .context(format!("cannot find from_branch '{name}'"))?, |
| 920 | ), | 925 | ), |
| 921 | None => ( | 926 | None => ( |
| @@ -937,7 +942,7 @@ fn identify_ahead_behind( | |||
| 937 | Some(name) => ( | 942 | Some(name) => ( |
| 938 | name.to_string(), | 943 | name.to_string(), |
| 939 | git_repo | 944 | git_repo |
| 940 | .get_tip_of_local_branch(name) | 945 | .get_tip_of_branch(name) |
| 941 | .context(format!("cannot find to_branch '{name}'"))?, | 946 | .context(format!("cannot find to_branch '{name}'"))?, |
| 942 | ), | 947 | ), |
| 943 | None => { | 948 | None => { |