# HG changeset patch # User Georges Racinet # Date 1697784180 -7200 # Node ID e553cd209215e6631c66f0ab2c13a227f101bce9 # Parent 83091c14058c9b2c7b15d014c52cca980df5e3ba rust-index: avoid double negation in find_gca_candidates() diff -r 83091c14058c -r e553cd209215 rust/hg-core/src/revlog/index.rs --- a/rust/hg-core/src/revlog/index.rs Fri Oct 20 08:17:00 2023 +0200 +++ b/rust/hg-core/src/revlog/index.rs Fri Oct 20 08:43:00 2023 +0200 @@ -1142,7 +1142,15 @@ continue; } let parent_seen = &seen[parent.0 as usize]; - if !poison { + if poison { + // this block is logically equivalent to poisoning parent + // and counting it as non interesting if it + // has been seen before (hence counted then as interesting) + if !parent_seen.is_empty() && !parent_seen.is_poisoned() { + interesting -= 1; + } + seen[parent.0 as usize].poison(); + } else { // Without the `interesting` accounting, this block would // be logically equivalent to: parent_seen |= current_seen // The parent counts as interesting if it was not already @@ -1153,14 +1161,6 @@ } else if *parent_seen != current_seen { seen[parent.0 as usize].union(¤t_seen); } - } else { - // this block is logically equivalent to poisoning parent - // and counting it as non interesting if it - // has been seen before (hence counted then as interesting) - if !parent_seen.is_empty() && !parent_seen.is_poisoned() { - interesting -= 1; - } - seen[parent.0 as usize].poison(); } }