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`).
This commit is contained in:
Martin von Zweigbergk 2021-08-11 11:10:49 -07:00
parent 7f335a4632
commit 45f926c234

View file

@ -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(