Re: Tags auto fetched by "git fetch origin" but not "git fetch origin main"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> 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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux