[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
[-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
[--dissociate] [--separate-git-dir <git-dir>]
- [--depth <depth>] [--[no-]single-branch] [--no-tags]
+ [--depth <depth>] [--[no-]single-branch] [--[no-]tags]
[--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]
[--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow]
[--filter=<filter-spec>] [--also-filter-submodules]] [--] <repository>
branch when `--single-branch` clone was made, no remote-tracking
branch is created.
-`--no-tags`::
- Don't clone any tags, and set
- `remote.<remote>.tagOpt=--no-tags` in the config, ensuring
- that future `git pull` and `git fetch` operations won't follow
- any tags. Subsequent explicit tag fetches will still work,
- (see linkgit:git-fetch[1]).
+`--[no-]tags`::
+ Control whether or not tags will be cloned. When `--no-tags` is
+ given, the option will be become permanent by setting the
+ `remote.<remote>.tagOpt=--no-tags` configuration. This ensures that
+ future `git pull` and `git fetch` won't follow any tags. Subsequent
+ explicit tag fetches will still work (see linkgit:git-fetch[1]).
+
+ By default, tags are cloned and passing `--tags` is thus typically a
+ no-op, unless it cancels out a previous `--no-tags`.
+
Can be used in conjunction with `--single-branch` to clone and
maintain a branch with no references other than a single cloned
static int option_no_checkout, option_bare, option_mirror, option_single_branch = -1;
static int option_local = -1, option_no_hardlinks, option_shared;
-static int option_no_tags;
+static int option_tags = 1; /* default enabled */
static int option_shallow_submodules;
static int config_reject_shallow = -1; /* unspecified */
static char *remote_name = NULL;
get_fetch_map(refs, &refspec->items[i], &tail, 0);
}
- if (!option_mirror && !option_single_branch && !option_no_tags)
+ if (!option_mirror && !option_single_branch && option_tags)
get_fetch_map(refs, &tag_refspec, &tail, 0);
refspec_item_clear(&tag_refspec);
if (refs) {
write_remote_refs(mapped_refs);
- if (option_single_branch && !option_no_tags)
+ if (option_single_branch && option_tags)
write_followtags(refs, msg);
}
N_("deepen history of shallow clone, excluding ref")),
OPT_BOOL(0, "single-branch", &option_single_branch,
N_("clone only one branch, HEAD or --branch")),
- OPT_BOOL(0, "no-tags", &option_no_tags,
- N_("don't clone any tags, and make later fetches not to follow them")),
+ OPT_BOOL(0, "tags", &option_tags,
+ N_("clone tags, and make later fetches not to follow them")),
OPT_BOOL(0, "shallow-submodules", &option_shallow_submodules,
N_("any cloned submodules will be shallow")),
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
git_config_set(key.buf, repo);
strbuf_reset(&key);
- if (option_no_tags) {
+ if (!option_tags) {
strbuf_addf(&key, "remote.%s.tagOpt", remote_name);
git_config_set(key.buf, "--no-tags");
strbuf_reset(&key);
if (option_branch)
expand_ref_prefix(&transport_ls_refs_options.ref_prefixes,
option_branch);
- if (!option_no_tags)
+ if (option_tags)
strvec_push(&transport_ls_refs_options.ref_prefixes,
"refs/tags/");