]> git.ipfire.org Git - thirdparty/git.git/commit
commit-graph: move slab-clearing to close_commit_graph()
authorJeff King <peff@peff.net>
Tue, 3 Oct 2023 20:27:52 +0000 (16:27 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Oct 2023 21:28:24 +0000 (14:28 -0700)
commitac6d45d11f24921ead899c74569b717a7895f4a5
treeb80930a3f9574de9406221bcea0bc41d7a19c7c8
parent716a6b2c3a54779e1e6f115a5950511d019f4d17
commit-graph: move slab-clearing to close_commit_graph()

When closing and freeing a commit-graph, the main entry point is
close_commit_graph(), which then uses close_commit_graph_one() to
recurse through the base_graph links and free each one.

Commit 957ba814bf (commit-graph: when closing the graph, also release
the slab, 2021-09-08) put the call to clear the slab into the recursive
function, but this is pointless: there's only a single global slab
variable. It works OK in practice because clearing the slab is
idempotent, but it makes the code harder to reason about and refactor.

Move it into the parent function so it's only called once (and there are
no other direct callers of the recursive close_commit_graph_one(), so we
are not hurting them).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c