[PATCH 2/6] revision: drop explicit check for commit graph
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 4, 2025, 12:49 UTC
- Message-ID
- <20250904-b4-pks-commit-graph-via-source-v1-2-d932c2481e1a@pks.im>
- In-Reply-To
- <20250904-b4-pks-commit-graph-via-source-v1-0-d932c2481e1a@pks.im>
When filtering down revisions by paths we know to use bloom filters from the commit graph, if we have any. The entry point for this is in `check_maybe_different_in_bloom_filter()`, where we first verify that:
- We do have a commit graph.
- That the commit is contained therein by checking that we have a
proper generation number.- And that the graph contains a bloom filter.
The first check is somewhat redundant though: if we don't have a commit graph, then the second check would already tell us that we don't have a generation number for the specific commit.
In theory this could be seen as a performance optimization to short-circuit for scenarios where there is no commit graph. But in practice this shouldn't matter: if there is no commit graph, then the commit graph data slab would also be unpopulated and thus a lookup of the commit should happen in constant time.
Drop the unnecessary check.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- revision.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/revision.c b/revision.c index 6ba8f67054..6018f30a99 100644 --- a/revision.c +++ b/revision.c @@ -774,9 +774,6 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs, struct bloom_filter *filter; int result = 0; - if (!revs->repo->objects->commit_graph) - return -1; - if (commit_graph_generation(commit) == GENERATION_NUMBER_INFINITY) return -1;
-- 2.51.0.417.g1ba7204a04.dirty