When a mixture of missing contexts and alive order conflicts are present in a file, the new "global" algorithm could miss order relations. The consequence was to make the conflicts harder to read.
MMQCFCIE6XK64R3QDV3ZSPAD3POWLKHZ2ZPUJP326FDLZROSYOCQC
let is_first_visit = visited.insert(current);
// If `current` is alive and already visited, pass.
if visited.contains(&(elt.vertex, elt.vertex)) {
continue
}
// Else, visit its children.
stack.push(StackElt { is_on_path: true, .. elt });
let is_first_visit = visited.insert((elt.vertex, elt.last_alive));
if len >= 2 && stack[len - 1].1 {
if let Some(last_on_path) = (&stack[..len - 1]).iter().rev().position(|x| x.2) {
if len >= 2 && stack[len - 1].is_alive() {
// If `elt` is alive, it doesn't matter which part
// `last_alive` the current path comes from, we can stop
// here.
visited.remove(&(elt.vertex, elt.last_alive));
visited.insert((elt.vertex, elt.vertex));
// The visited vertex is alive. Change the last_alive of its children
for x in &mut stack[len..] {
x.last_alive = elt.vertex
}
if let Some(last_on_path) = (&stack[..len - 1]).iter().rev().position(|x| x.is_on_path) {
if !stack[last_on_path].1 {
if let Some(last_alive_on_path) =
(&stack[..last_on_path]).iter().rev().position(|x| x.1)
{
let last_alive_on_path = last_on_path - 1 - last_alive_on_path;
debug!("repair zombies {:?} {:?}", last_alive_on_path, len - 1);
// We need to reconnect, and we can do it now
// since we won't have a chance to visit that
// edge (because non-PARENT edge we are
// inserting now starts from a vertex that is
// on the path, which means we've already
// pushed all its children onto the stack.).
put_graph_with_rev(
txn,
channel,
EdgeFlags::PSEUDO,
stack[last_alive_on_path].0,
stack[len - 1].0,
ChangeId::ROOT,
)?;
}
if !stack[last_on_path].is_alive() {
// We need to reconnect, and we can do it now
// since we won't have a chance to visit that
// edge (because non-PARENT edge we are
// inserting now starts from a vertex that is
// on the path, which means we've already
// pushed all its children onto the stack.).
put_graph_with_rev(
txn,
channel,
EdgeFlags::PSEUDO,
elt.last_alive,
stack[len - 1].vertex,
ChangeId::ROOT,
)?;