ok/jj
1
0
Fork 0
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:
Yuya Nishihara 2024-01-15 11:54:56 +09:00
parent c6b1ace9dd
commit 34956f17e5

View file

@ -264,6 +264,12 @@ pub fn reparent_range(
}
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();
for old_op in ops_to_reparent.into_iter().rev() {
let mut data = old_op.store_operation().clone();