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

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

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> 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.

> @@ -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.




[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]