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

Re: [WIP PATCH 0/2] Be more careful when prunning

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 7, 2011, 23:00 UTC
Message-ID
<7v39f4tnk8.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1317920187-17389-1-git-send-email-cmn@elego.de>
Carlos Martín Nieto <cmn@elego.de> writes:
Show 9 quoted lines
> Now comes the interesting part: when --tags is given, there is no
> refspec set up, fetch just sets up a global variable. What I'm
> thinking (and going to implement after dinner, unless people cry out
> against it) is this: just before calling prune_refs, add a refspec to
> the user-provided list with the refspec refs/tags/*:refs/tags/*
> similar to what fetch_one does if you gave it "tag v1.5.6". This would
> cause us to ignore the configured refspec and keep the branches. The
> lack of '+' is most certainly on purpose. Is there anything
> fundamentally wrong with that idea?

It sounds like that the approach should work and preserve the current "fetch --tags" semantics, but with one small caveat (which is not a downside).

As was discussed in a few separate threads last month, in the longer term I think we should fix the semantics of "fetch --tags" to mean "in addition to what you usually fetch with the configured refspecs, add that all matching refs/tags/*:refs/tags/* to the refspec" to reduce confusion. "Only fetch tags" may make sense if you have everything else, but by itself it is somewhat a senseless thing to do.

The semantics has been kept this way only from fear of breaking backward compatibility, but because nobody wants to only fetch tags without branches, this forces people to say "git fetch && git fetch --tags".

We should re-evaluate the design and change it at a major version boundary, I would think. And when that happens, we may need to rip out the special case you discussed above.

Thanks.
Previous: Carlos Martín Nieto
Message 14 of 14 in “[BUG?] git fetch -p -t prunes all non-tag refs”
  1. Ben BoeckelSep 26, 2011
  2. Junio C HamanoSep 26, 2011
  3. Ben BoeckelSep 26, 2011
  4. Carlos Martín NietoSep 26, 2011
  5. Junio C HamanoSep 26, 2011
  6. Carlos Martín NietoSep 26, 2011
  7. Jeff KingSep 27, 2011
  8. Carlos Martín NietoOct 4, 2011
  9. Jeff KingOct 4, 2011
  10. Carlos Martín NietoOct 4, 2011
  11. 0/2 Be more careful when prunningCarlos Martín Nieto, Oct 6, 2011
  12. 1/2 fetch: free all the additional refspecsCarlos Martín Nieto, Oct 6, 2011
  13. 2/2 fetch: honor the user-provided refspecs when pruning refsCarlos Martín Nieto, Oct 6, 2011
  14. Junio C HamanoOct 7, 2011

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.