Re: [PATCH] revision: free commit buffers for skipped commits
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 30, 2024, 21:27 UTC
- Message-ID
- <xmqq1q25r99i.fsf@gitster.g>
- In-Reply-To
- <20240830205331.GA1038751@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> But since this "--skip" case is an easy one-liner, it's worth fixing in > the meantime.
OK.
Show 10 quoted lines
> diff --git a/revision.c b/revision.c > index ac94f8d429..2d7ad2bddf 100644 > --- a/revision.c > +++ b/revision.c > @@ -4407,6 +4407,7 @@ static struct commit *get_revision_internal(struct rev_info *revs) > c = get_revision_1(revs); > if (!c) > break; > + free_commit_buffer(revs->repo->parsed_objects, c); > }
Even if we freed the buffer and then later need it, we'd read the buffer again anyway, so this is a safe thing to do. And because commits skipped in this separate loop will _never_ be given to the caller of get_revision(), this it a reasonable optimization, too.
Will queue. Thanks.