git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] clone: add a --no-tags option to clone without tags

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2017, 01:38 UTC
Message-ID
<xmqq60i1dvnk.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170418191553.15464-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 5 quoted lines
> Add a --no-tags option to "git clone" to clone without tags. Currently
> there's no easy way to clone a repository and end up with just a
> "master" branch via --single-branch, or track all branches and no
> tags. Now --no-tags can be added to "git clone" with or without
> --single-branch to clone a repository without tags.
Makes sense.
> +--no-tags::
> +	Don't clone any tags, and set `remote.origin.tagOpt=--no-tags`
> +	in the config, ensuring that future `git pull` and `git fetch`
> +	operations won't fetch any tags.

OK. Not just we ignore tags during the initial cloning, we set things up so that we do not _follow_ tags in subsequent fetches.

s/won't fetch/won't follow/ is probably needed, as we still allow users to fetch tags by explicitly naming them on the command line. The only thing we are doing is to refrain from auto-following.

As an end-user facing help, exact configuration name and value is much less helpful than telling them the effect of the setting in the words they understand, i.e. "make later fetches not to follow tags" or something. Hardcoded 'origin' in `remote.origin.tagOpt` is not correct anyway, so I'd suggest redoing this part of the doc.

Show 6 quoted lines
> @@ -120,6 +121,8 @@ static struct option builtin_clone_options[] = {
>  			N_("deepen history of shallow clone, excluding rev")),
>  	OPT_BOOL(0, "single-branch", &option_single_branch,
>  		    N_("clone only one branch, HEAD or --branch")),
> +	OPT_BOOL_NONEG(0, "no-tags", &option_no_tags,
> +		       N_("don't clone any tags, and set remote.<name>.tagOpt=--no-tags")),

Likewise. As an end-user facing help, exact configuration name and value is much less helpful than telling them the effect of the setting in the words they understand, i.e. "make later fetches not to follow tags" or something.

> +	if (option_no_tags) {
> +		strbuf_addf(&key, "remote.%s.tagOpt", option_origin);
Good to use option_origin.  
> +		git_config_set(key.buf, "--no-tags");
> +		strbuf_reset(&key);
> +	}
> +
Thanks.
Previous: Brandon WilliamsNext: Junio C Hamano
Message 5 of 11 in “Is there a way to get 'git fetch --no-tags' semantics with 'git clone'?”
  1. Ævar Arnfjörð BjarmasonApr 14, 2017
  2. clone: add a --no-tags option to clone without tagsÆvar Arnfjörð Bjarmason, Apr 18, 2017
  3. Ævar Arnfjörð BjarmasonApr 18, 2017
  4. Brandon WilliamsApr 18, 2017
  5. Junio C HamanoApr 19, 2017
  6. Junio C HamanoApr 19, 2017
  7. clone: add a --no-tags option to clone without tagsÆvar Arnfjörð Bjarmason, Apr 19, 2017
  8. Jonathan NiederApr 25, 2017
  9. Junio C HamanoApr 26, 2017
  10. Ævar Arnfjörð BjarmasonApr 26, 2017
  11. Jonathan NiederApr 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.