All of lore.kernel.org
 help / color / mirror / Atom feed
* Is there a way to get 'git fetch --no-tags' semantics with 'git clone'?
@ 2017-04-14 21:28 Ævar Arnfjörð Bjarmason
  2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 11+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-04-14 21:28 UTC (permalink / raw)
  To: Git Mailing List

As far as I can tell the only way to clone a given upstream repo,
which has an unknown main branch name without any tags is:

    git clone --single-branch <url> <repo> &&
    cd <repo> &&
    git tag -d $(git tag -l) &&
    git config remote.origin.tagOpt --no-tags

Is there really nothing like:

    git clone --single-branch --no-tags <url> <repo>

?

I suppose this can be done with the usual 'git init`, set the config &
then fetch dance, but in that case what part of 'git remote' or
friends exposes finding the remote "main" ref as --single-branch does?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-14 21:28 Is there a way to get 'git fetch --no-tags' semantics with 'git clone'? Ævar Arnfjörð Bjarmason
@ 2017-04-18 19:15 ` Ævar Arnfjörð Bjarmason
  2017-04-18 21:06   ` Ævar Arnfjörð Bjarmason
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-04-18 19:15 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy,
	Ævar Arnfjörð Bjarmason

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.

Before this the only way of doing this was either by manually tweaking
the config in a fresh repository:

    git init git &&
    cat >git/.git/config <<EOF &&
    [remote "origin"]
        url = git@github.com:git/git.git
        tagOpt = --no-tags
        fetch = +refs/heads/master:refs/remotes/origin/master
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    EOF
    cd git &&
    git pull

Which requires hardcoding the "master" name, which may not be the same
branch, or alternatively by setting tagOpt=--no-tags right after
cloning & deleting any existing tags:

    git clone --single-branch git@github.com:git/git.git &&
    cd git &&
    git config remote.origin.tagOpt --no-tags &&
    git tag -l | xargs git tag -d

Which of course was also subtly buggy if --branch was pointed at a
tag, leaving the user in a detached head:

    git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
    cd git &&
    git config remote.origin.tagOpt --no-tags &&
    git tag -l | xargs git tag -d

Now all this complexity becomes the much simpler:

    git clone --single-branch --no-tags git@github.com:git/git.git

Or in the case of cloning a single tag "branch":

    git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Fri, Apr 14, 2017 at 11:28 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> As far as I can tell the only way to clone a given upstream repo,
> which has an unknown main branch name without any tags is:
>
>     git clone --single-branch <url> <repo> &&
>     cd <repo> &&
>     git tag -d $(git tag -l) &&
>     git config remote.origin.tagOpt --no-tags
>
> Is there really nothing like:
>
>     git clone --single-branch --no-tags <url> <repo>
>
> ?
>
> I suppose this can be done with the usual 'git init`, set the config &
> then fetch dance, but in that case what part of 'git remote' or
> friends exposes finding the remote "main" ref as --single-branch does?

Here's a patch which implements this. It works, and I think it makes
sense for inclusion. It would be logical to follow this up with a
--no-tags-submodules similar to --no-shallow-submodules, but I ran out
of time.

 Documentation/git-clone.txt | 12 +++++++-
 builtin/clone.c             | 13 ++++++--
 t/t5612-clone-refspec.sh    | 73 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 93 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 30052cce49..ef78e6dcc6 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 	  [-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]
+	  [--depth <depth>] [--[no-]single-branch] [--no-tags]
 	  [--recurse-submodules] [--[no-]shallow-submodules]
 	  [--jobs <n>] [--] <repository> [<directory>]
 
@@ -215,6 +215,16 @@ objects from the source repository into a pack in the cloned repository.
 	branch when `--single-branch` clone was made, no remote-tracking
 	branch is created.
 
+--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.
++
+Can be used in conjunction with `--single-branch` to clone & maintain
+a branch with no references other than a single cloned branch. This is
+useful e.g. to maintain minimal clones of the default branch of some
+repository for search indexing.
+
 --recurse-submodules[=<pathspec]::
 	After the clone is created, initialize and clone submodules
 	within based on the provided pathspec.  If no pathspec is
diff --git a/builtin/clone.c b/builtin/clone.c
index 32c5843563..96908a4cd7 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -40,6 +40,7 @@ static const char * const builtin_clone_usage[] = {
 
 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_shallow_submodules;
 static int deepen;
 static char *option_template, *option_depth, *option_since;
@@ -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")),
 	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"),
@@ -563,7 +566,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
 	} else
 		get_fetch_map(refs, refspec, &tail, 0);
 
-	if (!option_mirror && !option_single_branch)
+	if (!option_mirror && !option_single_branch && !option_no_tags)
 		get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	return local_refs;
@@ -652,7 +655,7 @@ static void update_remote_refs(const struct ref *refs,
 
 	if (refs) {
 		write_remote_refs(mapped_refs);
-		if (option_single_branch)
+		if (option_single_branch && !option_no_tags)
 			write_followtags(refs, msg);
 	}
 
@@ -1035,6 +1038,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	git_config_set(key.buf, repo);
 	strbuf_reset(&key);
 
+	if (option_no_tags) {
+		strbuf_addf(&key, "remote.%s.tagOpt", option_origin);
+		git_config_set(key.buf, "--no-tags");
+		strbuf_reset(&key);
+	}
+
 	if (option_required_reference.nr || option_optional_reference.nr)
 		setup_reference();
 
diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
index 7ace2535c8..83317805a8 100755
--- a/t/t5612-clone-refspec.sh
+++ b/t/t5612-clone-refspec.sh
@@ -17,13 +17,20 @@ test_expect_success 'setup' '
 	echo four >file &&
 	git commit -a -m four &&
 	git checkout master &&
+	git tag five &&
 
 	# default clone
 	git clone . dir_all &&
 
+	# default clone --no-tags
+	git clone --no-tags . dir_all_no_tags &&
+
 	# default --single that follows HEAD=master
 	git clone --single-branch . dir_master &&
 
+	# default --single that follows HEAD=master with no tags
+	git clone --single-branch --no-tags . dir_master_no_tags &&
+
 	# default --single that follows HEAD=side
 	git checkout side &&
 	git clone --single-branch . dir_side &&
@@ -45,6 +52,9 @@ test_expect_success 'setup' '
 	# explicit --single with tag
 	git clone --single-branch --branch two . dir_tag &&
 
+	# explicit --single with tag and --no-tags
+	git clone --single-branch --no-tags --branch two . dir_tag_no_tags &&
+
 	# advance both "master" and "side" branches
 	git checkout side &&
 	echo five >file &&
@@ -75,7 +85,17 @@ test_expect_success 'by default no tags will be kept updated' '
 		git for-each-ref refs/tags >../actual
 	) &&
 	git for-each-ref refs/tags >expect &&
-	test_must_fail test_cmp expect actual
+	test_must_fail test_cmp expect actual &&
+	test_line_count = 2 actual
+'
+
+test_expect_success 'clone with --no-tags' '
+	(
+		cd dir_all_no_tags && git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	>expect &&
+	test_cmp expect actual
 '
 
 test_expect_success '--single-branch while HEAD pointing at master' '
@@ -87,7 +107,46 @@ test_expect_success '--single-branch while HEAD pointing at master' '
 	) &&
 	# only follow master
 	git for-each-ref refs/heads/master >expect &&
-	test_cmp expect actual
+	# get & check latest tags
+	test_cmp expect actual &&
+	(
+		cd dir_master &&
+		git fetch --tags &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags >expect &&
+	test_cmp expect actual &&
+	test_line_count = 2 actual
+'
+
+test_expect_success '--single-branch while HEAD pointing at master and --no-tags' '
+	(
+		cd dir_master_no_tags && git fetch &&
+		git for-each-ref refs/remotes/origin |
+		sed -e "/HEAD$/d" \
+		    -e "s|/remotes/origin/|/heads/|" >../actual
+	) &&
+	# only follow master
+	git for-each-ref refs/heads/master >expect &&
+	test_cmp expect actual &&
+	# get tags (noop)
+	(
+		cd dir_master_no_tags &&
+		git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	>expect &&
+	test_cmp expect actual &&
+	test_line_count = 0 actual &&
+	# get tags with --tags overrides tagOpt
+	(
+		cd dir_master_no_tags &&
+		git fetch --tags &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags >expect &&
+	test_cmp expect actual &&
+	test_line_count = 2 actual
 '
 
 test_expect_success '--single-branch while HEAD pointing at side' '
@@ -123,6 +182,16 @@ test_expect_success '--single-branch with explicit --branch with tag fetches upd
 	test_cmp expect actual
 '
 
+test_expect_success '--single-branch with explicit --branch with tag fetches updated tag despite --no-tags' '
+	(
+		cd dir_tag_no_tags && git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags/two >expect &&
+	test_cmp expect actual &&
+	test_line_count = 1 actual
+'
+
 test_expect_success '--single-branch with --mirror' '
 	(
 		cd dir_mirror && git fetch &&
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
@ 2017-04-18 21:06   ` Ævar Arnfjörð Bjarmason
  2017-04-18 23:30   ` Brandon Williams
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-04-18 21:06 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy,
	Ævar Arnfjörð Bjarmason

On Tue, Apr 18, 2017 at 9:15 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:

>                     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")),
>         OPT_BOOL(0, "shallow-submodules", &option_shallow_submodules,

I forgot to note that this is on top of my earlier patch which adds
OPT_BOOL_NONEG, see <20170418170914.9701-1-avarab@gmail.com>, but
otherwise applies on top of master, and will work just fine by
amending that to say OPT_BOOL (although --no-no-tags will then exist,
as noted in the other patch).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
  2017-04-18 21:06   ` Ævar Arnfjörð Bjarmason
@ 2017-04-18 23:30   ` Brandon Williams
  2017-04-19  1:38   ` Junio C Hamano
  2017-04-25 22:35   ` [PATCH] " Jonathan Nieder
  3 siblings, 0 replies; 11+ messages in thread
From: Brandon Williams @ 2017-04-18 23:30 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Nguyễn Thái Ngọc Duy

On 04/18, Ævar Arnfjörð Bjarmason wrote:
> 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.
> 
> Before this the only way of doing this was either by manually tweaking
> the config in a fresh repository:
> 
>     git init git &&
>     cat >git/.git/config <<EOF &&
>     [remote "origin"]
>         url = git@github.com:git/git.git
>         tagOpt = --no-tags
>         fetch = +refs/heads/master:refs/remotes/origin/master
>     [branch "master"]
>         remote = origin
>         merge = refs/heads/master
>     EOF
>     cd git &&
>     git pull
> 
> Which requires hardcoding the "master" name, which may not be the same
> branch, or alternatively by setting tagOpt=--no-tags right after
> cloning & deleting any existing tags:
> 
>     git clone --single-branch git@github.com:git/git.git &&
>     cd git &&
>     git config remote.origin.tagOpt --no-tags &&
>     git tag -l | xargs git tag -d
> 
> Which of course was also subtly buggy if --branch was pointed at a
> tag, leaving the user in a detached head:
> 
>     git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
>     cd git &&
>     git config remote.origin.tagOpt --no-tags &&
>     git tag -l | xargs git tag -d
> 
> Now all this complexity becomes the much simpler:
> 
>     git clone --single-branch --no-tags git@github.com:git/git.git
> 
> Or in the case of cloning a single tag "branch":
> 
>     git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---

Patch seems sane to me.

-- 
Brandon Williams

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
  2017-04-18 21:06   ` Ævar Arnfjörð Bjarmason
  2017-04-18 23:30   ` Brandon Williams
@ 2017-04-19  1:38   ` Junio C Hamano
  2017-04-19  5:32     ` Junio C Hamano
  2017-04-19 14:38     ` [PATCH v2] " Ævar Arnfjörð Bjarmason
  2017-04-25 22:35   ` [PATCH] " Jonathan Nieder
  3 siblings, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2017-04-19  1:38 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Brandon Williams, Nguyễn Thái Ngọc Duy

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-19  1:38   ` Junio C Hamano
@ 2017-04-19  5:32     ` Junio C Hamano
  2017-04-19 14:38     ` [PATCH v2] " Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2017-04-19  5:32 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Brandon Williams, Nguyễn Thái Ngọc Duy

Junio C Hamano <gitster@pobox.com> writes:

> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> 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.

I somewhat doubt the utility of this change.  "--single-branch"
already refrains from grabbing all the tags, and the tags it grabs
when "clone" runs and also in subsequent "fetch" are only the ones
relevant to that branch.  When a user is fetching say 'maint', it is
very likely that the user wants tags that are reachable from the tip
of 'maint' (if only to make the tip of that branch describable),
even though the user would not care about the tags on the other
branches that are ahead of 'maint'.

It is not that much code, and carrying it is not that much burden,
but I am reasonably sure that I won't use it myself.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] clone: add a --no-tags option to clone without tags
  2017-04-19  1:38   ` Junio C Hamano
  2017-04-19  5:32     ` Junio C Hamano
@ 2017-04-19 14:38     ` Ævar Arnfjörð Bjarmason
  2017-04-25 22:45       ` Jonathan Nieder
  1 sibling, 1 reply; 11+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-04-19 14:38 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy,
	Ævar Arnfjörð Bjarmason

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.

Before this the only way of doing this was either by manually tweaking
the config in a fresh repository:

    git init git &&
    cat >git/.git/config <<EOF &&
    [remote "origin"]
        url = git@github.com:git/git.git
        tagOpt = --no-tags
        fetch = +refs/heads/master:refs/remotes/origin/master
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    EOF
    cd git &&
    git pull

Which requires hardcoding the "master" name, which may not be the same
branch, or alternatively by setting tagOpt=--no-tags right after
cloning & deleting any existing tags:

    git clone --single-branch git@github.com:git/git.git &&
    cd git &&
    git config remote.origin.tagOpt --no-tags &&
    git tag -l | xargs git tag -d

Which of course was also subtly buggy if --branch was pointed at a
tag, leaving the user in a detached head:

    git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
    cd git &&
    git config remote.origin.tagOpt --no-tags &&
    git tag -l | xargs git tag -d

Now all this complexity becomes the much simpler:

    git clone --single-branch --no-tags git@github.com:git/git.git

Or in the case of cloning a single tag "branch":

    git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Wed, Apr 19, 2017 at 3:38 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> 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.  

I reworded all of this to hopefully be more helpful.

> Hardcoded 'origin' in `remote.origin.tagOpt` is not correct anyway,
> so I'd suggest redoing this part of the doc.

Changed, FWIW various parts of the existing clone docs do the same
thing, so a follow-up change to that would make sense...

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

*Nod* changed.

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

 Documentation/git-clone.txt | 14 ++++++++-
 builtin/clone.c             | 13 ++++++--
 t/t5612-clone-refspec.sh    | 73 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 95 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 30052cce49..57b3f478ed 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 	  [-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]
+	  [--depth <depth>] [--[no-]single-branch] [--no-tags]
 	  [--recurse-submodules] [--[no-]shallow-submodules]
 	  [--jobs <n>] [--] <repository> [<directory>]
 
@@ -215,6 +215,18 @@ objects from the source repository into a pack in the cloned 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]).
++
+Can be used in conjunction with `--single-branch` to clone & maintain
+a branch with no references other than a single cloned branch. This is
+useful e.g. to maintain minimal clones of the default branch of some
+repository for search indexing.
+
 --recurse-submodules[=<pathspec]::
 	After the clone is created, initialize and clone submodules
 	within based on the provided pathspec.  If no pathspec is
diff --git a/builtin/clone.c b/builtin/clone.c
index de85b85254..05f52d6f2b 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -40,6 +40,7 @@ static const char * const builtin_clone_usage[] = {
 
 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_shallow_submodules;
 static int deepen;
 static char *option_template, *option_depth, *option_since;
@@ -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(0, "no-tags", &option_no_tags,
+		 N_("don't clone any 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"),
@@ -563,7 +566,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
 	} else
 		get_fetch_map(refs, refspec, &tail, 0);
 
-	if (!option_mirror && !option_single_branch)
+	if (!option_mirror && !option_single_branch && !option_no_tags)
 		get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	return local_refs;
@@ -652,7 +655,7 @@ static void update_remote_refs(const struct ref *refs,
 
 	if (refs) {
 		write_remote_refs(mapped_refs);
-		if (option_single_branch)
+		if (option_single_branch && !option_no_tags)
 			write_followtags(refs, msg);
 	}
 
@@ -1035,6 +1038,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	git_config_set(key.buf, repo);
 	strbuf_reset(&key);
 
+	if (option_no_tags) {
+		strbuf_addf(&key, "remote.%s.tagOpt", option_origin);
+		git_config_set(key.buf, "--no-tags");
+		strbuf_reset(&key);
+	}
+
 	if (option_required_reference.nr || option_optional_reference.nr)
 		setup_reference();
 
diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
index 7ace2535c8..83317805a8 100755
--- a/t/t5612-clone-refspec.sh
+++ b/t/t5612-clone-refspec.sh
@@ -17,13 +17,20 @@ test_expect_success 'setup' '
 	echo four >file &&
 	git commit -a -m four &&
 	git checkout master &&
+	git tag five &&
 
 	# default clone
 	git clone . dir_all &&
 
+	# default clone --no-tags
+	git clone --no-tags . dir_all_no_tags &&
+
 	# default --single that follows HEAD=master
 	git clone --single-branch . dir_master &&
 
+	# default --single that follows HEAD=master with no tags
+	git clone --single-branch --no-tags . dir_master_no_tags &&
+
 	# default --single that follows HEAD=side
 	git checkout side &&
 	git clone --single-branch . dir_side &&
@@ -45,6 +52,9 @@ test_expect_success 'setup' '
 	# explicit --single with tag
 	git clone --single-branch --branch two . dir_tag &&
 
+	# explicit --single with tag and --no-tags
+	git clone --single-branch --no-tags --branch two . dir_tag_no_tags &&
+
 	# advance both "master" and "side" branches
 	git checkout side &&
 	echo five >file &&
@@ -75,7 +85,17 @@ test_expect_success 'by default no tags will be kept updated' '
 		git for-each-ref refs/tags >../actual
 	) &&
 	git for-each-ref refs/tags >expect &&
-	test_must_fail test_cmp expect actual
+	test_must_fail test_cmp expect actual &&
+	test_line_count = 2 actual
+'
+
+test_expect_success 'clone with --no-tags' '
+	(
+		cd dir_all_no_tags && git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	>expect &&
+	test_cmp expect actual
 '
 
 test_expect_success '--single-branch while HEAD pointing at master' '
@@ -87,7 +107,46 @@ test_expect_success '--single-branch while HEAD pointing at master' '
 	) &&
 	# only follow master
 	git for-each-ref refs/heads/master >expect &&
-	test_cmp expect actual
+	# get & check latest tags
+	test_cmp expect actual &&
+	(
+		cd dir_master &&
+		git fetch --tags &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags >expect &&
+	test_cmp expect actual &&
+	test_line_count = 2 actual
+'
+
+test_expect_success '--single-branch while HEAD pointing at master and --no-tags' '
+	(
+		cd dir_master_no_tags && git fetch &&
+		git for-each-ref refs/remotes/origin |
+		sed -e "/HEAD$/d" \
+		    -e "s|/remotes/origin/|/heads/|" >../actual
+	) &&
+	# only follow master
+	git for-each-ref refs/heads/master >expect &&
+	test_cmp expect actual &&
+	# get tags (noop)
+	(
+		cd dir_master_no_tags &&
+		git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	>expect &&
+	test_cmp expect actual &&
+	test_line_count = 0 actual &&
+	# get tags with --tags overrides tagOpt
+	(
+		cd dir_master_no_tags &&
+		git fetch --tags &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags >expect &&
+	test_cmp expect actual &&
+	test_line_count = 2 actual
 '
 
 test_expect_success '--single-branch while HEAD pointing at side' '
@@ -123,6 +182,16 @@ test_expect_success '--single-branch with explicit --branch with tag fetches upd
 	test_cmp expect actual
 '
 
+test_expect_success '--single-branch with explicit --branch with tag fetches updated tag despite --no-tags' '
+	(
+		cd dir_tag_no_tags && git fetch &&
+		git for-each-ref refs/tags >../actual
+	) &&
+	git for-each-ref refs/tags/two >expect &&
+	test_cmp expect actual &&
+	test_line_count = 1 actual
+'
+
 test_expect_success '--single-branch with --mirror' '
 	(
 		cd dir_mirror && git fetch &&
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] clone: add a --no-tags option to clone without tags
  2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
                     ` (2 preceding siblings ...)
  2017-04-19  1:38   ` Junio C Hamano
@ 2017-04-25 22:35   ` Jonathan Nieder
  3 siblings, 0 replies; 11+ messages in thread
From: Jonathan Nieder @ 2017-04-25 22:35 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy

Hi,

Ævar Arnfjörð Bjarmason wrote:

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

Could --single-branch be made to imply --no-tags, like --depth implies
--single-branch?  After all, all I wanted is that one branch, not some
tags.

Callers who really want the tags could still pass --tags to request
that.

Just thinking out loud,
Jonathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] clone: add a --no-tags option to clone without tags
  2017-04-19 14:38     ` [PATCH v2] " Ævar Arnfjörð Bjarmason
@ 2017-04-25 22:45       ` Jonathan Nieder
  2017-04-26  1:26         ` Junio C Hamano
  2017-04-26  8:56         ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 11+ messages in thread
From: Jonathan Nieder @ 2017-04-25 22:45 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy

Hi,

Ævar Arnfjörð Bjarmason wrote:

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

Now I've read the discussion from v1, so you can see my thoughts
evolving in real time. :)

The above feels a bit misleading when it says "there's no easy way to
clone a repository and end up with just a 'master' branch".
--single-branch does exactly that.  Some annotated tags *pointing to
its history* come along for the ride, but what harm are they doing?

In other words, I think the commit message needs a bit more detail about
the use case, to say why omitting those tags is useful.  The use case
is probably sane but it is not explained.  A side effect (and my main
motivation) is that this would make it crystal clear to people looking
at the patch in history that it is talking about tags that are part of
"master"'s history, not tags pointing elsewhere.

> Before this the only way of doing this was either by manually tweaking
> the config in a fresh repository:

Usually commit messages refer to the state of things without some
patch using the present tense --- e.g. "Without this patch, this
--no-tags option can be emulated by (1) manually tweaking the config
in a fresh repository, or (2) by setting tagOpt=--no-tags after
cloning and deleting any existing tags".

[...]
> Which of course was also subtly buggy if --branch was pointed at a
> tag, leaving the user in a detached head:
>
>     git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
>     cd git &&
>     git config remote.origin.tagOpt --no-tags &&
>     git tag -l | xargs git tag -d

At this point I lose the trail of thought.  I don't think it's
important to understanding the patch.

> Now all this complexity becomes the much simpler:
>
>     git clone --single-branch --no-tags git@github.com:git/git.git
>
> Or in the case of cloning a single tag "branch":
>
>     git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git

Nice.

[...]
>  Documentation/git-clone.txt | 14 ++++++++-
>  builtin/clone.c             | 13 ++++++--
>  t/t5612-clone-refspec.sh    | 73 +++++++++++++++++++++++++++++++++++++++++++--
>  3 files changed, 95 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
> index 30052cce49..57b3f478ed 100644
> --- a/Documentation/git-clone.txt
> +++ b/Documentation/git-clone.txt
> @@ -13,7 +13,7 @@ SYNOPSIS
>  	  [-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]
> +	  [--depth <depth>] [--[no-]single-branch] [--no-tags]

Can I pass --tags to negate a previous --no-tags?

[...]
> +--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]).
> ++
> +Can be used in conjunction with `--single-branch` to clone & maintain

nit: s/&/and/

[...]
> +test_expect_success 'clone with --no-tags' '
> +	(
> +		cd dir_all_no_tags && git fetch &&
> +		git for-each-ref refs/tags >../actual

nit: this would be easier to read with the 'cd' and 'git fetch' on
separate lines.

[...]
> +test_expect_success '--single-branch while HEAD pointing at master and --no-tags' '
> +	(
> +		cd dir_master_no_tags && git fetch &&

Likewise.

> +		git for-each-ref refs/remotes/origin |
> +		sed -e "/HEAD$/d" \
> +		    -e "s|/remotes/origin/|/heads/|" >../actual

Can $/ be expanded by the shell?

The rest looks sensible.

Thanks and hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] clone: add a --no-tags option to clone without tags
  2017-04-25 22:45       ` Jonathan Nieder
@ 2017-04-26  1:26         ` Junio C Hamano
  2017-04-26  8:56         ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2017-04-26  1:26 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Ævar Arnfjörð Bjarmason, git, Brandon Williams,
	Nguyễn Thái Ngọc Duy

Jonathan Nieder <jrnieder@gmail.com> writes:

> In other words, I think the commit message needs a bit more detail about
> the use case, to say why omitting those tags is useful.  The use case
> is probably sane but it is not explained.  A side effect (and my main
> motivation) is that this would make it crystal clear to people looking
> at the patch in history that it is talking about tags that are part of
> "master"'s history, not tags pointing elsewhere.

I agree that it is unclear "having no tags, not even the harmless
and usually useful ones that point at the history of the branch of
interest" is the point of this new feature from the documentation
and log message.  

Responding to your other message, I do not think this new feature
should be tied to --single-branch; I think having the tags to mark
commits in the branch's history (while not fetching other tags
irrelevant to the branch's history) is usually what users would
want.

>> Before this the only way of doing this was either by manually tweaking
>> the config in a fresh repository:
>
> Usually commit messages refer to the state of things without some
> patch using the present tense --- e.g. "Without this patch, this
> --no-tags option can be emulated by (1) manually tweaking the config
> in a fresh repository, or (2) by setting tagOpt=--no-tags after
> cloning and deleting any existing tags".

Thanks--I'll use this myself when responding to patches from other
people.  I recall getting irritated while reading some patches and
couldn't pinpoint why they were irritating, and now I realize that
it was because they said "Previously Git did X." and somesuch.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] clone: add a --no-tags option to clone without tags
  2017-04-25 22:45       ` Jonathan Nieder
  2017-04-26  1:26         ` Junio C Hamano
@ 2017-04-26  8:56         ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 11+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-04-26  8:56 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Git Mailing List, Junio C Hamano, Brandon Williams,
	Nguyễn Thái Ngọc Duy

On Wed, Apr 26, 2017 at 12:45 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi,
>
> Ęvar Arnfjörš Bjarmason wrote:
>
>> 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.
>
> Now I've read the discussion from v1, so you can see my thoughts
> evolving in real time. :)
>
> The above feels a bit misleading when it says "there's no easy way to
> clone a repository and end up with just a 'master' branch".
> --single-branch does exactly that.

I'll reword this, what I meant is "just a master branch [and no other
references]". Not "just the master branch [and no other branches]".

> Some annotated tags *pointing to
> its history* come along for the ride, but what harm are they doing?

I'll explain this in a bit more detail in the commit message & docs,
both you & Junio (in <xmqq1ssparom.fsf@gitster.mtv.corp.google.com>)
seem to be making the assumption that only getting & maintaining the
tags for the branch you're cloning is cheap.

This assumes a repo that while large, doesn't get a lot of releases on
its main branch. E.g. linux.git has ~650k commits, and ~500 v* tags,
that's a tag every 1300 commits or so.

Now if you run this on linux.git:

    $ git rev-list origin/master | parallel -j6 --progress 'test
"$(echo {} | cut -b1)" = 0 && git tag -a -m"msg" test-tag-{}'

You'll get a tag a bit more than every 16 commits, and now a lot of
everyday commands become slow, because a lot of them need to look at
every ref before they start:

    $ (time (git log -1 >/dev/null)) 2>&1|grep ^real
    real    0m1.304s

Whereas on a linux.git without all those tags:

    $ (time (git log -1 >/dev/null)) 2>&1|grep ^real
    real    0m0.027s

And you can imagine what this does to some other commands, e.g. bash completion:

    $ git log <TAB>
    Display all 512 possibilities? (y or n)

v.s.:

    $ git log <TAB>
    Display all 42129 possibilities? (y or n)

Furthermore, if upstream has a high tag churn, i.e. creates lots of
tags but prunes them regularly even if you set tagOpts=--prune you'll
still end up with an every slower local repository as you slowly
accumulate every tag upstream has created every, you'd need to fetch
with:

    $ git fetch origin --prune 'refs/tags/*:refs/tags/*'

Simply never fetching the tags in the first place & making sure they
aren't fetched avoids all of this, and is perfect e.g. for the use
case of something that runs an automated "pull" on the repo to index
its code (I initially wrote this for a https://github.com/etsy/hound/
setup), or if you'd just like to run the likes of "git log" on the
master branch without starting that up taking a second longer.

> In other words, I think the commit message needs a bit more detail about
> the use case, to say why omitting those tags is useful.  The use case
> is probably sane but it is not explained.  A side effect (and my main
> motivation) is that this would make it crystal clear to people looking
> at the patch in history that it is talking about tags that are part of
> "master"'s history, not tags pointing elsewhere.

I'll add that.

>> Before this the only way of doing this was either by manually tweaking
>> the config in a fresh repository:
>
> Usually commit messages refer to the state of things without some
> patch using the present tense --- e.g. "Without this patch, this
> --no-tags option can be emulated by (1) manually tweaking the config
> in a fresh repository, or (2) by setting tagOpt=--no-tags after
> cloning and deleting any existing tags".
>
> [...]
>> Which of course was also subtly buggy if --branch was pointed at a
>> tag, leaving the user in a detached head:
>>
>>     git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
>>     cd git &&
>>     git config remote.origin.tagOpt --no-tags &&
>>     git tag -l | xargs git tag -d
>
> At this point I lose the trail of thought.  I don't think it's
> important to understanding the patch.

I'm going to leave that in because anyone who needs this feature for a
similar use-case (which I'll explain in more detail), would need to do
exactly that to get a bug-compatible version of the same behavior if
they need to run on an older git version for whatever reason.

>> Now all this complexity becomes the much simpler:
>>
>>     git clone --single-branch --no-tags git@github.com:git/git.git
>>
>> Or in the case of cloning a single tag "branch":
>>
>>     git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git
>
> Nice.
>
> [...]
>>  Documentation/git-clone.txt | 14 ++++++++-
>>  builtin/clone.c             | 13 ++++++--
>>  t/t5612-clone-refspec.sh    | 73 +++++++++++++++++++++++++++++++++++++++++++--
>>  3 files changed, 95 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
>> index 30052cce49..57b3f478ed 100644
>> --- a/Documentation/git-clone.txt
>> +++ b/Documentation/git-clone.txt
>> @@ -13,7 +13,7 @@ SYNOPSIS
>>         [-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]
>> +       [--depth <depth>] [--[no-]single-branch] [--no-tags]
>
> Can I pass --tags to negate a previous --no-tags?

Yeah both --tags and --no-no-tags work as with every other OPT_BOOL
option. See "[RFC PATCH] parse-options: disallow double-negations of
options starting with no-".

> [...]
>> +--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]).
>> ++
>> +Can be used in conjunction with `--single-branch` to clone & maintain
>
> nit: s/&/and/

Will fix.

> [...]
>> +test_expect_success 'clone with --no-tags' '
>> +     (
>> +             cd dir_all_no_tags && git fetch &&
>> +             git for-each-ref refs/tags >../actual
>
> nit: this would be easier to read with the 'cd' and 'git fetch' on
> separate lines.
>
> [...]
>> +test_expect_success '--single-branch while HEAD pointing at master and --no-tags' '
>> +     (
>> +             cd dir_master_no_tags && git fetch &&
>
> Likewise.

This was following the existing style in the file, but sure, I'll
prepend a patch to this series to fix all of that before building this
patch on top.

>> +             git for-each-ref refs/remotes/origin |
>> +             sed -e "/HEAD$/d" \
>> +                 -e "s|/remotes/origin/|/heads/|" >../actual
>
> Can $/ be expanded by the shell?

I think not, and if there's some issue with it it's obscure enough to
not have caused issues since 31b808a032 ("clone --single: limit the
fetch refspec to fetched branch", 2012-09-20) which introduced this
pattern earlier in the test file, I'm just copy/pasting similar setup
from elsewhere in the file.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-04-26  8:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 21:28 Is there a way to get 'git fetch --no-tags' semantics with 'git clone'? Ævar Arnfjörð Bjarmason
2017-04-18 19:15 ` [PATCH] clone: add a --no-tags option to clone without tags Ævar Arnfjörð Bjarmason
2017-04-18 21:06   ` Ævar Arnfjörð Bjarmason
2017-04-18 23:30   ` Brandon Williams
2017-04-19  1:38   ` Junio C Hamano
2017-04-19  5:32     ` Junio C Hamano
2017-04-19 14:38     ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2017-04-25 22:45       ` Jonathan Nieder
2017-04-26  1:26         ` Junio C Hamano
2017-04-26  8:56         ` Ævar Arnfjörð Bjarmason
2017-04-25 22:35   ` [PATCH] " Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.