mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-26 14:00:51 +00:00
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:
parent
7f335a4632
commit
45f926c234
1 changed files with 3 additions and 5 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue