From: Jeff King Date: Tue, 30 Jun 2026 05:38:25 GMT Subject: Re: [PATCH] builtin/history: unuse the commit buffer after use Message-ID: <20260630053825.GC2495216@coredump.intra.peff.net> In-Reply-To: <94b0bed5-c86a-4291-b958-52f09faebd29@gmail.com> On Tue, Jun 30, 2026 at 09:13:28AM +0530, Kaartic Sivaraam wrote: > On 15/06/26 15:18, Patrick Steinhardt wrote: > > Huh, curious. That seems to hint that we're missing test coverage for > > this specific scenario, as our test suite doesn't detect this leak. > > > > Indeed. The tricky thing is (as mentioned in another thread), this is > happening only when we get a commit not cached in the commit slab. Once we > get an idea on how certain commits get cached in the commit slab while > others don't, we can write a test case that would catch this leak. Try: make SANITIZE=leak cd t GIT_TEST_COMMIT_GRAPH=1 ./t3451-history-reword.sh -v -i That shows off the leak. It's possible we should be running the LSan tests in CI with more feature flags enabled, but I suspect it's just as likely to miss a case as to add one (i.e., there might be a leak when we _don't_ use the commit graph). We could do both, but the combinatorics get expensive. You could add a specific test that builds a commit graph and runs a history-reword. That would show off the fix, but it's so specific that I find it a bit unlikely that it would catch a useful regression in the future. So I dunno. I would be content with showing the commands above in the commit message. -Peff