]> git.ipfire.org Git - thirdparty/git.git/commit
object: clear grafts when clearing parsed object pool
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:09:12 +0000 (12:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:11 +0000 (08:49 -0700)
commit0d1d22f5a385d05bde40303c17483db2eec499b3
tree3b6af161c7e9c2ae1b880ec7d585331f0b117d62
parentb8849e236f7a32d43ab3ba087587a336d69329b0
object: clear grafts when clearing parsed object pool

We do not clear grafts part of the parsed object pool when clearing the
pool itself, which can lead to memory leaks when a repository is being
cleared.

Fix this by moving `reset_commit_grafts()` into "object.c" and making it
part of the `struct parsed_object_pool` interface such that we can call
it from `parsed_object_pool_clear()`. Adapt `parsed_object_pool_new()`
to take and store a reference to its owning repository, which is needed
by `unparse_commit()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
commit.h
object.c
object.h
repository.c
shallow.c