From 45f926c234b00b81331a42f36c58b908eb097f4d Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 11 Aug 2021 11:10:49 -0700 Subject: [PATCH] cli: don't require --allow-backwards when creating a branch If a branch doesn't exist yet, it's clearly safe to move it "forward" to any commit (it was simply a bug that we required `--allow-backards`). --- src/commands.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index d8163e1f5..a10c82019 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -2056,15 +2056,13 @@ fn cmd_backout( fn is_fast_forward(repo: RepoRef, branch_name: &str, new_target_id: &CommitId) -> bool { if let Some(current_target) = repo.view().get_local_branch(branch_name) { - if current_target + current_target .adds() .iter() .any(|add| repo.index().is_ancestor(add, new_target_id)) - { - return true; - } + } else { + true } - false } fn cmd_branch(