From a9e4c6772a378fd28edbca9b9267d2e7d08bee2c Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 23 Feb 2024 12:25:11 +0000 Subject: fix(push): remove force push bug introduced in b931b37e26486e4e6d15f302e87141dcf2f596ba --- src/sub_commands/send.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 588e7d1..b5ab78f 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -47,7 +47,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { let git_repo = Repo::discover().context("cannot find a git repository")?; let mut commits: Vec = { - if args.since_or_revision_range.eq("master..HEAD") { + if args.since_or_revision_range.is_empty() + || args.since_or_revision_range.eq("master..HEAD") + { let (from_branch, to_branch, ahead, behind) = identify_ahead_behind(&git_repo, &None, &None)?; @@ -794,7 +796,7 @@ fn identify_ahead_behind( None => { let (name, commit) = git_repo .get_main_or_master_branch() - .context("a destination branch (to_branch) is not specified and the defaults (main or master) do not exist")?; + .context("the default branches (main or master) do not exist")?; (name.to_string(), commit) } }; @@ -867,7 +869,7 @@ mod tests { identify_ahead_behind(&git_repo, &None, &None) .unwrap_err() .to_string(), - "a destination branch (to_branch) is not specified and the defaults (main or master) do not exist", + "the default branches (main or master) do not exist", ); Ok(()) } -- cgit v1.2.3