From: Junio C Hamano <gitster@pobox.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Igor Todorovski <itodorov@ca.ibm.com>,
Bence Ferdinandy <bence@ferdinandy.com>,
Jonathan Tan <jonathantanmy@google.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Tags are no longer fetched when fetching specific commit
Date: Fri, 14 Feb 2025 10:35:14 -0800 [thread overview]
Message-ID: <xmqqv7tcl6hp.fsf@gitster.g> (raw)
In-Reply-To: <Z650WoqFwCSo6svH@nand.local> (Taylor Blau's message of "Thu, 13 Feb 2025 17:38:18 -0500")
Taylor Blau <me@ttaylorr.com> writes:
> So I think the right fix would really be something like:
>
> --- 8< ---
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index fe2b26c74a..0e63621e6c 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1770,9 +1770,8 @@ static int do_fetch(struct transport *transport,
>
> if (tags == TAGS_SET || tags == TAGS_DEFAULT) {
> must_list_refs = 1;
> - if (transport_ls_refs_options.ref_prefixes.nr)
> - strvec_push(&transport_ls_refs_options.ref_prefixes,
> - "refs/tags/");
I guess the original "if we are giving prefixes already, then make
sure we learn about tags" is because the semantics of the ref-prefix
is peculiar, in that without _any_, there is no limitation and the
remote end would advertise all its refs, but if there is even one,
the remote end would advertise only the ones that match any prefix?
> + strvec_push(&transport_ls_refs_options.ref_prefixes,
> + "refs/tags/");
So this change would make sure that, even if somebody else already
added a prefix earlier, we would always ask about tags if we come
into this block. It also means when nobody has added a prefix
before we reach here, we still add prefix to ask about tags. The
implication of which may be rather grave. If a later code relied
on us _not_ asking for tags here (because nobody is limiting the
ls-refs request with prefix), after this change, that code will
now see that there is some prefix requested already, and if we
wanted to retain what that code does, we would need to adjust that
code (and then the need for similar modification cascades X-<).
> }
>
> if (uses_remote_tracking(transport, rs)) {
> --- >8 ---
>
> But I'm unfamiliar enough with this area that I'd appreciate comments
> from the authors of these various commits, all of whom have been CC'd.
> Does this seem right to you, or am I totally down the wrong path?
I have no idea without doing a deep dive myself, for which I have
failed to find time for so far.
I have to wonder if the first thing we should do is to update the
logic to decide what ref prefixes to use, so that it does not do
such an incremental strvec_push(). There are multiple questions in
the form "Do we need to know about X?" the code path need to ask
before deciding what prefixes to use, and before Bence's "We need to
know about HEAD, because we want to know about its symref value",
refs/tags hierarchy was one (and only?) thing we needed to ask
about. The bug under discussion smells like the result of how
brittle the code's assumption about what prefixes other parts would
want to ask. This code did not assume there is anybody else, and
that is why it broke when we started asking about HEAD. Now we have
two possible X's in that question (refs/tags and HEAD). We may want
to make sure the code is robust enough when we add the third one.
Thanks.
next prev parent reply other threads:[~2025-02-14 18:35 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 3:49 Tags are no longer fetched when fetching specific commit Igor Todorovski
2025-02-13 22:38 ` Taylor Blau
2025-02-14 13:53 ` Bence Ferdinandy
2025-02-14 18:35 ` Junio C Hamano [this message]
2025-02-21 7:25 ` Jeff King
2025-03-07 23:27 ` [PATCH] fetch: fix following tags when fetching specific OID Taylor Blau
2025-03-07 23:32 ` Taylor Blau
2025-03-08 0:10 ` Junio C Hamano
2025-03-08 3:23 ` Bence Ferdinandy
2025-03-09 3:01 ` [PATCH 0/9] fetch: further ref-prefix cleanups and optimizations Jeff King
2025-03-09 3:01 ` [PATCH 1/9] t5702: fix typo in test name Jeff King
2025-03-12 21:30 ` Taylor Blau
2025-03-13 5:37 ` Jeff King
2025-03-09 3:01 ` [PATCH 2/9] t5516: prefer "oid" to "sha1" in some test titles Jeff King
2025-03-09 3:02 ` [PATCH 3/9] t5516: drop NEEDSWORK about v2 reachability behavior Jeff King
2025-03-12 21:30 ` Taylor Blau
2025-03-09 3:02 ` [PATCH 4/9] t5516: beef up exact-oid ref prefixes test Jeff King
2025-03-09 3:07 ` [PATCH 5/9] refspec_ref_prefixes(): clean up refspec_item logic Jeff King
2025-03-12 21:38 ` Taylor Blau
2025-03-13 5:41 ` Jeff King
2025-03-13 13:26 ` Junio C Hamano
2025-03-17 22:24 ` [PATCH 0/4] refspec: treat 'fetch' as a Boolean value Taylor Blau
2025-03-17 22:24 ` [PATCH 1/4] " Taylor Blau
2025-03-18 0:24 ` Jeff King
2025-03-18 0:26 ` Jeff King
2025-03-18 22:44 ` Taylor Blau
2025-03-17 22:24 ` [PATCH 2/4] refspec: replace `refspec_init()` with fetch/push variants Taylor Blau
2025-03-17 22:24 ` [PATCH 3/4] refspec: remove refspec_item_init_or_die() Taylor Blau
2025-03-17 22:24 ` [PATCH 4/4] refspec: replace `refspec_item_init()` with fetch/push variants Taylor Blau
2025-03-17 23:26 ` [PATCH 0/4] refspec: treat 'fetch' as a Boolean value Junio C Hamano
2025-03-18 22:40 ` Taylor Blau
2025-03-18 22:50 ` [PATCH v2 " Taylor Blau
2025-03-18 22:50 ` [PATCH v2 1/4] " Taylor Blau
2025-03-18 22:50 ` [PATCH v2 2/4] refspec: replace `refspec_init()` with fetch/push variants Taylor Blau
2025-03-18 22:50 ` [PATCH v2 3/4] refspec: remove refspec_item_init_or_die() Taylor Blau
2025-03-18 22:50 ` [PATCH v2 4/4] refspec: replace `refspec_item_init()` with fetch/push variants Taylor Blau
2025-03-19 15:31 ` [PATCH v2 0/4] refspec: treat 'fetch' as a Boolean value Elijah Newren
2025-03-17 22:00 ` [PATCH 5/9] refspec_ref_prefixes(): clean up refspec_item logic Taylor Blau
2025-03-17 23:25 ` Junio C Hamano
2025-03-18 22:47 ` Taylor Blau
2025-03-09 3:08 ` [PATCH 6/9] fetch: ask server to advertise HEAD for config-less fetch Jeff King
2025-03-12 21:43 ` Taylor Blau
2025-03-13 5:46 ` Jeff King
2025-03-13 12:26 ` Junio C Hamano
2025-03-17 22:23 ` Taylor Blau
2025-03-09 3:10 ` [PATCH 7/9] fetch: stop protecting additions to ref-prefix list Jeff King
2025-03-12 21:45 ` Taylor Blau
2025-03-09 3:20 ` [PATCH 8/9] fetch: avoid ls-refs only to ask for HEAD symref update Jeff King
2025-03-13 15:53 ` Junio C Hamano
2025-03-17 18:06 ` Jeff King
2025-03-17 19:01 ` Junio C Hamano
2025-03-18 5:39 ` [PATCH 0/2] limiting followRemoteHEAD being used Jeff King
2025-03-18 5:40 ` [PATCH 1/2] fetch: only respect followRemoteHEAD with configured refspecs Jeff King
2025-03-18 23:02 ` Taylor Blau
2025-03-18 5:41 ` [PATCH 2/2] fetch: don't ask for remote HEAD if followRemoteHEAD is "never" Jeff King
2025-03-18 19:18 ` [PATCH 0/2] limiting followRemoteHEAD being used Junio C Hamano
2025-03-18 23:02 ` Taylor Blau
2025-03-09 3:21 ` [PATCH 9/9] fetch: use ref prefix list to skip ls-refs Jeff King
2025-03-12 21:29 ` [PATCH 0/9] fetch: further ref-prefix cleanups and optimizations Taylor Blau
2025-03-12 21:49 ` Taylor Blau
2025-03-13 5:50 ` Jeff King
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=xmqqv7tcl6hp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bence@ferdinandy.com \
--cc=git@vger.kernel.org \
--cc=itodorov@ca.ibm.com \
--cc=jonathantanmy@google.com \
--cc=me@ttaylorr.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).