From: Brandon Williams <bmwill@google.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH] clone: add a --no-tags option to clone without tags
Date: Tue, 18 Apr 2017 16:30:30 -0700 [thread overview]
Message-ID: <20170418233030.GA41018@google.com> (raw)
In-Reply-To: <20170418191553.15464-1-avarab@gmail.com>
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
next prev parent reply other threads:[~2017-04-18 23:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170418233030.GA41018@google.com \
--to=bmwill@google.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).