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

Re: [BUG] git fetch fetches tags matching negative refspec

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2022, 15:30 UTC
Message-ID
<xmqqlepjivv4.fsf@gitster.g>
In-Reply-To
<221013.865ygomybw.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 7 quoted lines
> Because your refspec doesn't include refs/tags/*:, try e.g.:
>
> 	git fetch https://github.com/git/git.git 'refs/tags/*:refs/tags/*' --no-tags --dry-run
>
> That's what "--no-tags", i.e. it's per-se (and confusingly) nothing to
> do with whether you get tags or not, it's to do with whether we to tag
> following.

It indeed is confusing and might warrant some clarification, if not updating.

 * "--tags" is equivalent to giving "refs/tags*:refs/tags*", so it
   might be natural to expect that you can say the same thing as
   above with "fetch $URL --tags --no-tags", but it does not work
   that way.  Command line parser treats "--tags" and "--no-tags" as
   if they follow the "last one wins" semantics.
 * As discussed in this thread, what "--no-tags" really means is "do
   not follow tags"; there is no way to countermand a "--no-tags"
   earlier on the command line to say "earlier we said do not
   follow, but we changed our mind.  Please do follow tags".
It would have been nice if we had from day one
 * "--tags": equivalent to writing "refs/tags/*:refs/tags/*"
 * "--no-tags": "earlier we said --tags, but we changed our
   mind. Please forget we earlier said --tags".
 * "--follow-tags": automatically fetch tags that point at an
   object that were fetched (default).
 * "--no-follow-tags": stop following tags.

but I do not think it is worth the churn and transition pain to change it after more than 15 years.

Previous: Erik Cervin EdinNext: Erik Cervin Edin
Message 6 of 7 in “[BUG] git fetch fetches tags matching negative refspec”
  1. Erik Cervin EdinOct 12, 2022
  2. Ævar Arnfjörð BjarmasonOct 12, 2022
  3. Erik Cervin EdinOct 12, 2022
  4. Ævar Arnfjörð BjarmasonOct 12, 2022
  5. Erik Cervin EdinOct 13, 2022
  6. Junio C HamanoOct 13, 2022
  7. Erik Cervin EdinOct 18, 2022

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.