git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-pack: clean up extra_have oid array

From
Jacob Keller <jacob.keller@gmail.com>
Date
Jun 30, 2025, 22:14 UTC
Message-ID
<CA+P7+xo29ibqM7uXNuWyNy39G1Lx=8+6p4BxvQw7=PR7PjVW8w@mail.gmail.com>
In-Reply-To
<xmqqfrfh5mis.fsf@gitster.g>
On Mon, Jun 30, 2025 at 7:31 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
>
> Jacob Keller <jacob.e.keller@intel.com> writes:
>
> > From: Jacob Keller <jacob.keller@gmail.com>
> >
> > Commit c8009635785e ("fetch-pack, send-pack: clean up shallow oid
> > array", 2024-09-25) cleaned up the shallow oid array in cmd_send_pack,
> > but didn't clean up extra_have, which is still leaked at program exit.
> > I suspect the particular tests in t5539 don't trigger any additions to
> > the extra_have array, which explains why the tests can pass leak free
> > despite this gap.
> >
> > Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> > ---
> > I didn't check to see why the t5539 tests don't leak. This leak occured for
> > me in a day-to-day run with my local git build that happened to still have
> > sanitizers enabled:
>
> The other side may tell you about objects you _cannot_ fetch from
> them, but if you have them, these objects can participate in the
> common ancestor discovery and reduce the size of the transfer.
>
> If the repository A you are pushing into use an alternate object
> store B (i.e., created by "git clone --reference B $URL A" to make A
> borrow from another local repository B) for example, the refs in
> that alternate B that point at objects not in the repository A are
> shown as "extra" objects.
>
> Perhaps we can have these tests push into such a repository?
>
I probably won't personally have time to work on extending these tests.

Thanks, Jake

Show 16 quoted lines
> > diff --git a/builtin/send-pack.c b/builtin/send-pack.c
> > index c6e0e9d05186..61486e378cab 100644
> > --- a/builtin/send-pack.c
> > +++ b/builtin/send-pack.c
> > @@ -343,6 +343,7 @@ int cmd_send_pack(int argc,
> >       free_refs(remote_refs);
> >       free_refs(local_refs);
> >       refspec_clear(&rs);
> > +     oid_array_clear(&extra_have);
> >       oid_array_clear(&shallow);
> >       clear_cas_option(&cas);
> >       return ret;
>
> The change looks obviously correct.
>
> Thanks.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “send-pack: clean up extra_have oid array”
  1. send-pack: clean up extra_have oid arrayJacob Keller, Jun 27, 2025
  2. Junio C HamanoJun 30, 2025
  3. Jacob KellerJun 30, 2025
  4. Junio C HamanoJul 1, 2025
  5. Jacob KellerJul 1, 2025
  6. Junio C HamanoJul 1, 2025
  7. Jeff KingJul 3, 2025
  8. Jacob KellerJul 3, 2025
  9. Jeff KingJul 3, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.