From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Yukai Chou <muzimuzhi@gmail.com>, git@vger.kernel.org
Subject: Re: Tags auto fetched by "git fetch origin" but not "git fetch origin main"
Date: Thu, 29 Aug 2024 15:38:29 -0700 [thread overview]
Message-ID: <xmqqjzfzt0nu.fsf@gitster.g> (raw)
In-Reply-To: <ZtD0kJU_OdBBktZ2@tapette.crustytoothpaste.net> (brian m. carlson's message of "Thu, 29 Aug 2024 22:22:08 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> But the `--tags` option says this:
>
> Fetch all tags from the remote (i.e., fetch remote tags refs/tags/* into
> local tags with the same name), in addition to whatever else would
> otherwise be fetched. Using this option alone does not subject tags to
> pruning, even if --prune is used (though tags may be pruned anyway if
> they are also the destination of an explicit refspec; see --prune).
>
> That implies that all tags are fetched.
That is stronger than "implies", I would think. Indeed I know from
the code inspection that the auto-following only triggers when neither
--tags or --no-tags option is given, i.e. builtin/fetch.c has this:
if (tags == TAGS_DEFAULT && autotags)
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
where the variable tags is initialized to TAGS_DEFAULT,
--tags/--no-tags sets it to TAGS_SET or TAGS_UNSET, and autotags is
incremented only if a refspec we use has right hand side after the
colon, i.e. stores what we fetched in our refs/ namespace.
> I think we need somebody to test things and clarify the documentation.
Done ;-)
> In addition, it might be useful to add a `--relevant-tags` option or
A similar option is called "--follow-tags" on the "git push" side.
I _think_ it is just the matter of adding the option and have it set
the tags variable back to TAGS_DEFAULT, i.e.
diff --git c/builtin/fetch.c w/builtin/fetch.c
index c297569a47..f22c00a39d 100644
--- c/builtin/fetch.c
+++ w/builtin/fetch.c
@@ -2186,6 +2186,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
N_("fetch all tags and associated objects"), TAGS_SET),
OPT_SET_INT('n', NULL, &tags,
N_("do not fetch all tags (--no-tags)"), TAGS_UNSET),
+ OPT_SET_INT(0, "follow-tags", &tags,
+ N_("auto-follow tags"), TAGS_DEFAULT)),
OPT_INTEGER('j', "jobs", &max_jobs,
N_("number of submodules fetched in parallel")),
OPT_BOOL(0, "prefetch", &prefetch,
but I didn't look too deeply into it. It needs compile testing,
documentation updates and new teststo cover the behaviour.
Thanks.
next prev parent reply other threads:[~2024-08-29 22:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 23:23 Tags auto fetched by "git fetch origin" but not "git fetch origin main" Yukai Chou
2024-08-29 21:32 ` brian m. carlson
2024-08-29 21:44 ` Junio C Hamano
2024-08-29 22:22 ` brian m. carlson
2024-08-29 22:38 ` Junio C Hamano [this message]
2024-08-29 23:16 ` Yukai Chou
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=xmqqjzfzt0nu.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=muzimuzhi@gmail.com \
--cc=sandals@crustytoothpaste.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox