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

Re: [PATCH] git fetch one tag only

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 7, 2012, 17:08 UTC
Message-ID
<7v8vfzjbhi.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vpq9bk7o5.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> It is a separate matter if we should add some special case to further
> reduce the cases where auto-following happens. I personally do not
> think any change is needed.
I do not care too deeply either way, but after doing
	$ git init blank && cd blank
and in an empty repository:
        $ git fetch $over_there v1.0.0

will grab the named tag and drop it in FETCH_HEAD, without adding anything to your local refs, while

	$ git fetch $over_there tag v1.0.0

will grab the named tag and copy it to your refs/tags/v1.0.0, and auto-follow all the tags that point at commits that are reachable.

To grab and store _only_ v1.0.0 in the local refs, you need to say "do not auto-follow" with

	$ git fetch $over_there --no-tags tag v1.0.0

While it may be workable, the user experience could be better in a couple of different ways.

 * It is not fair to expect anybody to guess that "--no-tags" means
   "--no-auto-follow-tags" without reading documentation.
	$ git fetch $over_there --no-auto-follow-tags tag v1.0.0
   might be an improvement, but of course, it is a bit longer to
   spell ;-).
 * The auto-follow kicks in whenever you tell "fetch" to update some
   refs locally.  Maybe if we tweak the rule and auto-follow kick in
   only when you tell "fetch" to update some refs outside refs/tags
   locally,
	$ git fetch $over_there tag v1.0.0
   will fetch and store _only_ the v1.0.0 tag.
   Of course, any behaviour change is a regression, and if done
   without an escape hatch, such a change robs people one useful
   feature: grab tag v1.0.0 and others older than that tag in one
   go.
I won't be coding any of the above; just thinking aloud. 
Previous: cheng renquanNext: cheng renquan
Message 7 of 9 in “git fetch one tag only”
  1. git fetch one tag onlycheng renquan, Jun 7, 2012
  2. Junio C HamanoJun 7, 2012
  3. cheng renquanJun 7, 2012
  4. Junio C HamanoJun 7, 2012
  5. cheng renquanJun 7, 2012
  6. cheng renquanJun 7, 2012
  7. Junio C HamanoJun 7, 2012
  8. cheng renquanJun 8, 2012
  9. Junio C HamanoJun 8, 2012

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.