Message ID | 20240830205331.GA1038751@coredump.intra.peff.net (mailing list archive) |
---|---|
State | Accepted |
Commit | 6bd2ae67a5be4e08cd2bfc611c3d08707b1416e1 |
Headers | show |
Series | revision: free commit buffers for skipped commits | expand |
Jeff King <peff@peff.net> writes: > But since this "--skip" case is an easy one-liner, it's worth fixing in > the meantime. OK. > 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.
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); } }