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`).
@@ -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(
