forked from mirrors/jj
op_walk: assert that virtual root op is not reparented
This is enforced by the caller, but it's scary if it weren't.
This commit is contained in:
parent
c6b1ace9dd
commit
34956f17e5
1 changed files with 6 additions and 0 deletions
|
@ -264,6 +264,12 @@ pub fn reparent_range(
|
||||||
}
|
}
|
||||||
let unreachable_ids = unwanted_ids;
|
let unreachable_ids = unwanted_ids;
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
ops_to_reparent
|
||||||
|
.last()
|
||||||
|
.map_or(true, |op| op.id() != op_store.root_operation_id()),
|
||||||
|
"root operation cannot be rewritten"
|
||||||
|
);
|
||||||
let mut rewritten_ids = HashMap::new();
|
let mut rewritten_ids = HashMap::new();
|
||||||
for old_op in ops_to_reparent.into_iter().rev() {
|
for old_op in ops_to_reparent.into_iter().rev() {
|
||||||
let mut data = old_op.store_operation().clone();
|
let mut data = old_op.store_operation().clone();
|
||||||
|
|
Loading…
Reference in a new issue