Subject: [PATCH v2 0/2] Some random object database related fixes

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 11 Dec 2025 08:19:57 +0100

Hi,

this patch series fixes some small issues I've discovered while working
on some other patch series. I've decided to split it out of these
because I'm hitting the same issues in multiple series, and I don't want
those to become dependent on one another.

The patch series is built on top of f0ef5b6d9b with
ps/object-source-management at ac65c70663 (odb: handle recreation of
quarantine directories, 2025-11-19) merged into it.

Changes in v2:
  - Drop the first commit that regards geometric repacking with promisor
    remotes. As it turns out my assertion was wrong: geometric repacks
    do and have to consider promisors, but they will fail to handle
    them. This is a bigger topic to fix though, so I'll rather want to
    move this into a separate patch series.
  - Tighten tests a bit for the commit-graph generation.
  - Stop referring to a "subsequent" commit that doesn't exist.
  - Link to v1: https://lore.kernel.org/r/[email-masked]

Thanks!

Patrick

---
Patrick Steinhardt (2):
      builtin/gc: fix condition for whether to write commit graphs
      odb: properly close sources before freeing them

 builtin/gc.c           |  8 +++++---
 odb.c                  |  2 +-
 t/t7900-maintenance.sh | 25 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 4 deletions(-)

Range-diff versus v1:

1:  5c15065406 < -:  ---------- builtin/repack: fix geometric repacks with promisor remotes
2:  2fa3991003 ! 1:  1702bf6e7f builtin/gc: fix condition for whether to write commit graphs
    @@ t/t7900-maintenance.sh: test_expect_success 'commit-graph auto condition' '
     +		git commit --allow-empty -m main-1 &&
     +		git commit --allow-empty -m main-2 &&
     +		git merge feature &&
    -+		git branch -D feature &&
     +
     +		# We have 6 commit, none of which are covered by a commit
     +		# graph. So this must be the boundary at which we start to
3:  a06d0716c3 ! 2:  7dd4e6fabe odb: properly close sources before freeing them
    @@ Metadata
      ## Commit message ##
         odb: properly close sources before freeing them
     
    -    In the next commit we are about to move the packfile store into the ODB
    -    source so that we have one store per source. This will lead to a memory
    -    leak in the following commit when reading data from a submodule via
    -    git-grep(1):
    +    It is possible to hit a memory leak when reading data from a submodule
    +    via git-grep(1):
     
           Direct leak of 192 byte(s) in 1 object(s) allocated from:
             #0 0x55555562e726 in calloc (git+0xda726)

---
base-commit: 2797238193944b52d12624a04a962f40b9bcad69
change-id: 20251205-odb-related-fixes-5f48a0993ef7