pr-2144/spkrka/krka/remove-get-reachable-subset-v2-v1
tagged this
09 Jun 19:28
From: Kristofer Karlsson <krka@spotify.com> get_reachable_subset() and tips_reachable_from_bases() answer the same question: given a set of bases and a set of tips, which tips are reachable from at least one base? get_reachable_subset() was introduced in fcb2c0769d (2018-11-02) for add_missing_tags() in remote.c. tips_reachable_from_bases() was added in cbfe360b14 (2023-03-20) as part of the ahead-behind series. The two were never consolidated. With a commit-graph, tips_reachable_from_bases() can have an edge: its DFS raises the generation floor as lower targets are found, pruning more aggressively than the static floor in get_reachable_subset(). Without generation numbers, some edge cases may be slower with DFS instead of BFS since the date-ordered prio_queue naturally stays near the top of the graph, but this should not matter in practice -- worst case both visit the full graph down from the bases. The flag in remote.c changes from 1 (bit 0) to TMP_MARK (bit 4) because tips_reachable_from_bases() uses SEEN (bit 0) internally. TMP_MARK is already used for deduplication earlier in the same function and is cleared before the reachability check. Signed-off-by: Kristofer Karlsson <krka@spotify.com> Submitted-As: https://lore.kernel.org/git/pull.2144.git.1781033285419.gitgitgadget@gmail.com