git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* unclear documentation of git fetch --tags option and tagopt config
@ 2012-12-13  6:29 乙酸鋰
  2012-12-13 18:44 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: 乙酸鋰 @ 2012-12-13  6:29 UTC (permalink / raw)
  To: git

Hi,

With git fetch --tags
or remote.origin.tagopt = --tags
git fetch only fetches tags, but not branches.
Current documentation does not mention that no branches are fetched /
pulled when --tags option or remote.origin.tagopt = --tags is
specified.

Regards,
ch3cooli

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

* Re: unclear documentation of git fetch --tags option and tagopt config
  2012-12-13  6:29 unclear documentation of git fetch --tags option and tagopt config 乙酸鋰
@ 2012-12-13 18:44 ` Junio C Hamano
  2012-12-13 23:54   ` Philip Oakley
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-12-13 18:44 UTC (permalink / raw)
  To: 乙酸鋰; +Cc: git

乙酸鋰 <ch3cooli@gmail.com> writes:

> With git fetch --tags
> or remote.origin.tagopt = --tags
> git fetch only fetches tags, but not branches.
> Current documentation does not mention that no branches are fetched /
> pulled when --tags option or remote.origin.tagopt = --tags is
> specified.

In the canonical form you spell out what you want to fetch from
where, and a lazy "git fetch" or "git fetch origin" that does not
specify what are to be fetched are the special cases.  Because they
do not say what to fetch, they would become a no-op, which would not
be very useful, if there is no special casing for them.  Instead,
they use sensible default, taking refspec from the configuration
variable remote.$name.fetch.

Giving refspecs or the "--tags" option from the command line is a
way to explicitly override this default, hence:

    $ git fetch origin HEAD

only fetches the history leading to the commit at HEAD at the
remote, ignoring the configured refspecs.  As "--tags" is a synonym
to "refs/tags/*:refs/tags/*", "git fetch --tags origin" tells us to
ignore refspecs and grab only the tags, i.e.:

    $ git fetch origin "refs/tags/*:refs/tags/*"

which does not grab any branches.

You can of course do:

    $ git fetch --tags origin refs/heads/master:refs/remotes/origin/master

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

* Re: unclear documentation of git fetch --tags option and tagopt config
  2012-12-13 18:44 ` Junio C Hamano
@ 2012-12-13 23:54   ` Philip Oakley
  2012-12-14  0:13     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Oakley @ 2012-12-13 23:54 UTC (permalink / raw)
  To: Junio C Hamano, 乙酸鋰; +Cc: git

From: "Junio C Hamano" <gitster@pobox.com> Sent: Thursday, December 13, 
2012 6:44 PM
> 乙酸鋰 <ch3cooli@gmail.com> writes:
>
>> With git fetch --tags
>> or remote.origin.tagopt = --tags
>> git fetch only fetches tags, but not branches.
>> Current documentation does not mention that no branches are fetched /
>> pulled when --tags option or remote.origin.tagopt = --tags is
>> specified.
>
> In the canonical form you spell out what you want to fetch from
> where, and a lazy "git fetch" or "git fetch origin" that does not
> specify what are to be fetched are the special cases.  Because they
> do not say what to fetch, they would become a no-op, which would not
> be very useful, if there is no special casing for them.  Instead,
> they use sensible default, taking refspec from the configuration
> variable remote.$name.fetch.
>
> Giving refspecs or the "--tags" option from the command line is a
> way to explicitly override this default, hence:
>
>    $ git fetch origin HEAD
>
> only fetches the history leading to the commit at HEAD at the
> remote, ignoring the configured refspecs.  As "--tags" is a synonym
> to "refs/tags/*:refs/tags/*", "git fetch --tags origin" tells us to
> ignore refspecs and grab only the tags, i.e.:
>
>    $ git fetch origin "refs/tags/*:refs/tags/*"
>
> which does not grab any branches.
>
> You can of course do:
>
>    $ git fetch --tags origin 
> refs/heads/master:refs/remotes/origin/master
>
> --

What would be the best way of updating the documentation to clarify the 
point? Given ch3cooli's previous surprise.

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

* Re: unclear documentation of git fetch --tags option and tagopt config
  2012-12-13 23:54   ` Philip Oakley
@ 2012-12-14  0:13     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-12-14  0:13 UTC (permalink / raw)
  To: Philip Oakley; +Cc: 乙酸鋰, git

"Philip Oakley" <philipoakley@iee.org> writes:

> What would be the best way of updating the documentation to clarify the 
> point? Given ch3cooli's previous surprise.

Oh, thanks for bringing it up.  I was about to start another message
that begins with "Having said all that..." ;-)

I think the entire paragraph should be rewritten.  The first long
sentence explains that you will get tags that point at the branches
and other stuff you follow by default, so there is no need to
explicitly ask for tags most of the time.  While that is true, it is
secondary in describing what "--tags" is about.  It is to grab all
tags and store them locally, and that needs to come at the very
beginning.

And that auto-following behaviour is already described in the
previous entry for -n/--no-tags.  So how about something like this:

	This is a short-hand for giving "refs/tags/*:refs/tags/*"
	refspec from the command line, to ask all tags to be fetched
	and stored locally.

Note that it is deliberate that the above does not mention tagopt
configuration at all.  The variable was primarily meant to be used
with --no-tags, so that with this:

    [remote "origin"] tagopt = --no-tags

you can "git fetch origin" to keep up with the development on
branches without having to fetch tags from there.  Fetching tags and
only tags from a remote is almost always not what you want; in other
words, remote."origin".tagopt set to --tags is a misconfiguration
99% of the time, unless you are only interested in following tagged
release points.

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

end of thread, other threads:[~2012-12-14  0:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13  6:29 unclear documentation of git fetch --tags option and tagopt config 乙酸鋰
2012-12-13 18:44 ` Junio C Hamano
2012-12-13 23:54   ` Philip Oakley
2012-12-14  0:13     ` Junio C Hamano

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