rust-index: avoid double negation in find_gca_candidates()
authorGeorges Racinet <georges.racinet@octobus.net>
Fri, 20 Oct 2023 08:43:00 +0200
changeset 51248 e553cd209215
parent 51247 83091c14058c
child 51249 61a6ef876efd
rust-index: avoid double negation in find_gca_candidates()
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(&current_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();
                 }
             }