]> git.ipfire.org Git - thirdparty/git.git/commit - transport.c
transport: stop needlessly copying bundle header references
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 4 Mar 2022 18:32:10 +0000 (19:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Mar 2022 21:24:18 +0000 (13:24 -0800)
commit0f0d118c650fd0fe117063fbd196782b4f219410
treee2b404c9b033aa348a84ec3d1f55e0d1322b50bb
parentbf67dd8d9a29d02e44c622f62762a1cfc58fb3bb
transport: stop needlessly copying bundle header references

Amend the logic added in fddf2ebe388 (transport: teach all vtables to
allow fetch first, 2019-08-21) and save ourselves pointless work in
fetch_refs_from_bundle().

The fetch_refs_from_bundle() caller doesn't care about the "struct
ref *result" return value of get_refs_from_bundle(), and doesn't need
any of the work we were doing in looping over the
"data->header.references" in get_refs_from_bundle().

So this change saves us work, and also fixes a memory leak that we had
when called from fetch_refs_from_bundle(). The other caller of
get_refs_from_bundle() is the "get_refs_list" member we set up for the
"struct transport_vtable bundle_vtable". That caller does care about
the "struct ref *result" return value.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
transport.c