git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] clone: allow detached checkout when --branch takes a tag
Date: Fri, 6 Jan 2012 14:35:21 +0700	[thread overview]
Message-ID: <CACsJy8B2FGzQ2FFAx2wJohmkWe41+UETx6FZFwLNGY2fb74ZNg@mail.gmail.com> (raw)
In-Reply-To: <7v7h16nmpy.fsf@alter.siamese.dyndns.org>

2012/1/5 Junio C Hamano <gitster@pobox.com>:
> Also, the user is likely to want to fetch and integrate from the origin
> with his own history. How should "git pull" and "git fetch" work in the
> resulting repository? What should the remote.origin.* look like?

fetch should behave the same regardless this patch. remote.origin.*
looks exactly the same. Branch tracking is not set up so pull works
half way.

> You clone a single lineage of the history, either shallowly or fully,
> either starting at the tip of one single branch or a named tag.
>
> What is the expected use scenario of a resulting repository of this new
> feature? As this is creating a repository, not a tarball extract, you
> certainly would want the user to build further history in the resulting
> repository, and it would need a real branch at some point, preferably
> before any new commit is made. Which makes me think that the only reason
> we would use a detached HEAD would be because we cannot decide what name
> to give to that single branch and make it the responsibility of the user
> to run "git checkout -b $whatever" as the first thing.

We can still commit with detached HEAD but I guess it's not
recommended. For a quick, throwaway repository, it's probably OK.

> I think the real cause of the above is because this patch and its previous
> companion patch conflate the meaning of the "--branch" option with the
> purpose of specifying which lineage of the history to copy. The option is
> described to name the local branch that is checked out, instead of using
> the the same name the remote's primary branch. But these patches abuse the
> option to name something different at the same time---the endpoint of the
> single lineage to be copied.
>
> These two may often be the same, and use of "clone --branch=master" in
> such a case would mean that you want to name the local branch of the final
> checkout to be "master" _and_ the endpoint of the single lineage you are
> copying is also their "master".
>
> But the "tag" extension proposed with this change is different.
>
> You are specifying an endpoint of the single lineage with the option that
> is different from any of the branches at the origin, and because you used
> the "--branch" option for that purpose, you lost the way to specify the
> primary thing the option wanted to express: what the name of the resulting
> checkout should be.
>
> Perhaps something like "clone --branch=master --$endpoint=v1.7.8" that
> says "I want a clone of the repository limited to a single lineage, whose
> history ends at the commit pointed by the v1.7.8 tag, and name the local
> checkout my master branch" be more appropriate?

Branch naming is a local thing. Maybe we could get away with always
name it "master" if fetched from a tag. Branch tracking is not set up
in this case, so if they want to follow up with upstream, they have to
do some more themselves (including renaming "master" to something else
for less confusion with upstream "master"). New option is not easily
discovered, while "git branch -r master foo" is quite easy.
-- 
Duy

  reply	other threads:[~2012-01-06  7:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 13:49 [PATCH] clone: allow detached checkout when --branch takes a tag Nguyễn Thái Ngọc Duy
2012-01-05 14:18 ` Jeff King
2012-01-06 11:09   ` Nguyen Thai Ngoc Duy
2012-01-06 14:42     ` Jeff King
2012-01-05 16:22 ` Junio C Hamano
2012-01-06  7:35   ` Nguyen Thai Ngoc Duy [this message]
2012-01-08 11:46 ` [PATCH v2 1/6] t5601: add && Nguyễn Thái Ngọc Duy
2012-01-08 11:46   ` [PATCH v2 2/6] clone: write detached HEAD in bare repositories Nguyễn Thái Ngọc Duy
2012-01-08 11:46   ` [PATCH v2 3/6] clone: factor out checkout code Nguyễn Thái Ngọc Duy
2012-01-10  0:32     ` Junio C Hamano
2012-01-10  2:01       ` Nguyen Thai Ngoc Duy
2012-01-10  4:59         ` Junio C Hamano
2012-01-10  5:57           ` Nguyen Thai Ngoc Duy
2012-01-08 11:46   ` [PATCH v2 4/6] clone: --branch=<branch> always means refs/heads/<branch> Nguyễn Thái Ngọc Duy
2012-01-10  0:33     ` Junio C Hamano
2012-01-08 11:46   ` [PATCH v2 5/6] clone: allow --branch to take a tag Nguyễn Thái Ngọc Duy
2012-01-08 11:46   ` [PATCH v2 6/6] clone: print advice on checking out detached HEAD Nguyễn Thái Ngọc Duy
2012-01-10  0:36     ` Junio C Hamano
2012-01-10  1:54       ` Nguyen Thai Ngoc Duy
2012-01-10  4:49         ` Junio C Hamano
2012-01-10  5:54           ` Nguyen Thai Ngoc Duy
2012-01-10  9:56   ` [PATCH v3 00/10] nd/clone-detached Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 " Nguyễn Thái Ngọc Duy
2012-01-13 19:52       ` Junio C Hamano
2012-01-14  4:48         ` Nguyen Thai Ngoc Duy
2012-01-14  6:53           ` Junio C Hamano
2012-01-14  7:40             ` Nguyen Thai Ngoc Duy
2012-01-15  2:34               ` Junio C Hamano
2012-01-16  9:46       ` [PATCH v5 00/10] nd/clone-detached rebase onto nd/clone-single-branch Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 01/10] t5601: add missing && cascade Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 02/10] clone: write detached HEAD in bare repositories Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 03/10] clone: factor out checkout code Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 04/10] clone: factor out HEAD update code Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 05/10] clone: factor out remote ref writing Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 06/10] clone: delay cloning until after remote HEAD checking Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 07/10] clone: --branch=<branch> always means refs/heads/<branch> Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 08/10] clone: refuse to clone if --branch points to bogus ref Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 09/10] clone: allow --branch to take a tag Nguyễn Thái Ngọc Duy
2012-01-16  9:46       ` [PATCH v5 10/10] clone: print advice on checking out detached HEAD Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 01/10] t5601: add missing && cascade Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 02/10] clone: write detached HEAD in bare repositories Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 03/10] clone: factor out checkout code Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 04/10] clone: factor out HEAD update code Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 05/10] clone: factor out remote ref writing Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 06/10] clone: delay cloning until after remote HEAD checking Nguyễn Thái Ngọc Duy
2012-01-13  7:21     ` [PATCH v4 07/10] clone: --branch=<branch> always means refs/heads/<branch> Nguyễn Thái Ngọc Duy
2012-01-13  7:22     ` [PATCH v4 08/10] clone: refuse to clone if --branch points to bogus ref Nguyễn Thái Ngọc Duy
2012-01-13  7:22     ` [PATCH v4 09/10] clone: allow --branch to take a tag Nguyễn Thái Ngọc Duy
2012-01-13  7:22     ` [PATCH v4 10/10] clone: print advice on checking out detached HEAD Nguyễn Thái Ngọc Duy
2012-01-10  9:56   ` [PATCH v3 01/10] t5601: add missing && cascade Nguyễn Thái Ngọc Duy
2012-01-10  9:56   ` [PATCH v3 02/10] clone: write detached HEAD in bare repositories Nguyễn Thái Ngọc Duy
2012-01-10  9:57   ` [PATCH v3 03/10] clone: factor out checkout code Nguyễn Thái Ngọc Duy
2012-01-10  9:57   ` [PATCH v3 04/10] clone: factor out HEAD update code Nguyễn Thái Ngọc Duy
2012-01-10  9:57   ` [PATCH v3 05/10] clone: factor out remote ref writing Nguyễn Thái Ngọc Duy
2012-01-10  9:57   ` [PATCH v3 06/10] clone: delay cloning until after remote HEAD checking Nguyễn Thái Ngọc Duy
2012-01-11 19:36     ` Junio C Hamano
2012-01-12  1:27       ` Nguyen Thai Ngoc Duy
2012-01-24  0:15     ` Junio C Hamano
2012-01-24  0:34       ` Junio C Hamano
2012-01-24  0:39         ` Junio C Hamano
2012-01-24  7:01           ` Nguyen Thai Ngoc Duy
2012-01-10  9:57   ` [PATCH v3 07/10] clone: --branch=<branch> always means refs/heads/<branch> Nguyễn Thái Ngọc Duy
2012-01-11 20:01     ` Junio C Hamano
2012-01-12  3:00       ` Nguyen Thai Ngoc Duy
2012-01-10  9:57   ` [PATCH v3 08/10] clone: refuse to clone if --branch points to bogus ref Nguyễn Thái Ngọc Duy
2012-01-10  9:57   ` [PATCH v3 09/10] clone: allow --branch to take a tag Nguyễn Thái Ngọc Duy
2012-01-11 23:57     ` Junio C Hamano
2012-01-10  9:57   ` [PATCH v3 10/10] clone: print advice on checking out detached HEAD Nguyễn Thái Ngọc Duy

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACsJy8B2FGzQ2FFAx2wJohmkWe41+UETx6FZFwLNGY2fb74ZNg@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).