From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/4] transport: mark unused parameters in fetch_refs_from_bundle()
Date: Fri, 17 Mar 2023 13:28:48 -0700 [thread overview]
Message-ID: <xmqq7cvfgm0v.fsf@gitster.g> (raw)
In-Reply-To: <ZBS8vt97YJj3wMxn@coredump.intra.peff.net> (Jeff King's message of "Fri, 17 Mar 2023 15:17:18 -0400")
Jeff King <peff@peff.net> writes:
> We don't look at the "to_fetch" or "nr_heads" parameters at all. At
> first glance this seems like a bug (or at least pessimisation), because
> it means we fetch more objects from the bundle than we actually need.
> But the bundle does not have any way of computing the set of reachable
> objects itself (we'd have to pull all of the objects out to walk them).
> And anyway, we've probably already paid most of the cost of grabbing the
> objects, since we must copy the bundle locally before accessing it.
>
> So it's perfectly reasonable for the bundle code to just pull everything
> into the local object store. Unneeded objects can be dropped later via
> gc, etc.
>
> But we should mark these unused parameters as such to avoid the wrath of
> -Wunused-parameter.
Very well described, and I agree with the reasoning.
Will queue all four. Thanks.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> transport.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/transport.c b/transport.c
> index 81950bf755f..c5abf26f31e 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -167,7 +167,8 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
> }
>
> static int fetch_refs_from_bundle(struct transport *transport,
> - int nr_heads, struct ref **to_fetch)
> + int nr_heads UNUSED,
> + struct ref **to_fetch UNUSED)
> {
> struct bundle_transport_data *data = transport->data;
> struct strvec extra_index_pack_args = STRVEC_INIT;
prev parent reply other threads:[~2023-03-17 20:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 19:13 [PATCH 0/4] more unused-parameter fixes Jeff King
2023-03-17 19:16 ` [PATCH 1/4] mailmap: drop debugging code Jeff King
2023-03-17 20:08 ` Eric Sunshine
2023-03-17 21:13 ` Jeff King
2023-03-17 19:16 ` [PATCH 2/4] http: drop unused parameter from start_object_request() Jeff King
2023-03-17 19:17 ` [PATCH 3/4] http: mark unused parameter in fill_active_slot() callbacks Jeff King
2023-03-17 19:17 ` [PATCH 4/4] transport: mark unused parameters in fetch_refs_from_bundle() Jeff King
2023-03-17 20:28 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq7cvfgm0v.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.