mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 23:06:45 +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,16 +2056,14 @@ fn cmd_backout(
|
||||||
|
|
||||||
fn is_fast_forward(repo: RepoRef, branch_name: &str, new_target_id: &CommitId) -> bool {
|
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 let Some(current_target) = repo.view().get_local_branch(branch_name) {
|
||||||
if current_target
|
current_target
|
||||||
.adds()
|
.adds()
|
||||||
.iter()
|
.iter()
|
||||||
.any(|add| repo.index().is_ancestor(add, new_target_id))
|
.any(|add| repo.index().is_ancestor(add, new_target_id))
|
||||||
{
|
} else {
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cmd_branch(
|
fn cmd_branch(
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
|
|
Loading…
Reference in a new issue