git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git clone tag shallow

From
Thibault Kruse <tibokruse@googlemail.com>
Date
Feb 18, 2013, 10:11 UTC
Message-ID
<CAByu6UVfArRXGLTKgM=nw0fzij1urcVdzxx6xdoHihODD-LtRA@mail.gmail.com>
In-Reply-To
<7vliamascv.fsf@alter.siamese.dyndns.org>
Hi Junio,
On Mon, Feb 18, 2013 at 10:22 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> Thibault Kruse <tibokruse@googlemail.com> writes:
>
>> Whenever a command description involves "<branch>" this can, depending
>> on the command, refer to
>> 1) a name that, when prepended with "refs/heads/", is a valid ref,
>> 2) a name that, when prepended with "refs/heads/" or "refs/tags", is a
>> valid ref,
>> 3) a name that, when prepended with "refs/[heads|tags]/", or unique in
>> "refs/remotes/*/" is a valid ref
>>
>> Now in the docu I don't see a nice distinction between 1), 2) and 3).
>> I could work on a patch if someone
>> tells me how to clearly distinguish those cases.
>
> It is _very_ true that we do not give strict distinction in many
> cases in the SYNOPSIS section.
>
> It is clear that (1) should use <branch> or even <branch-name>.
> "git checkout master" and "git checkout head/master" mean very
> different things.  The former is the "git checkout <branch-name>"
> case---checkout the named branch and prepare to grow the history of
> that branch.  The latter is "git checkout <committish>"---detach the
> HEAD at that commit, and even when the committish was named using
> the name of an existing branch (e.g. "master^0" or "heads/master"),
> prevent future commits made in that state from affecting the branch.
>
> I am not sure why you meant to treat (2) and (3) differently,
> though.  Care to elaborate?
As in my example, git clone --branch <branch> does not accept all of (3).

I now see that indeed the options section for git clone --branch has been changed to inlude the information that tags are also allowed, so that's in order.

Show 5 quoted lines
> Outside "git checkout", we historically deliberately stayed loose in
> an attempt to help beginners by avoiding <committish> or <ref>, when
> most people are expected to feed branch names to the command and
> used <branch>.  I am not sure if it is a good idea to break such a
> white lie just to be technically more correct in the first place.

That's fair enough, I guess, I am not sure either. If I understand you right, the Synopsis and description are supposed to explain the non-hackish usage of commands, whereas documentation after the OPTIONS headline is supposed to be more of a complete description. Hence e.g. the synopsis of git-checkout does not mention the --t,--track,--no-track options, and takes a liberal approach to option syntaxes (listing '[-p|--patch]', but only '-m', but not '[-m|--merge]'), similar git-clone help does not mention the '--branch' option in the synopsis for that reason, I guess. Do I get this right?

Does this also extend to the (bash) tab completion? E.g. hitting tab after "git clone --", offers me (Ubuntu precise, git 1.7.9.5): --bare --local --no-checkout --origin --reference --template= --depth --mirror --no-hardlinks --quiet --shared --upload-pack

missing: ---recursive --recurse-submodules (--[no-]single-branch) --separate-git-dir --verbose --progress --branch

Is this also intentional?
cheers,
  Thibault
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “git clone tag shallow”
  1. Thibault KruseFeb 17, 2013
  2. Duy NguyenFeb 18, 2013
  3. Thibault KruseFeb 18, 2013
  4. Junio C HamanoFeb 18, 2013
  5. Thibault KruseFeb 18, 2013
  6. Junio C HamanoFeb 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.