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

Re: fetch <repo> <branch>:<branch> fetches tags?

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 29, 2008, 04:19 UTC
Message-ID
<20080129041928.GL24004@spearce.org>
In-Reply-To
<7v3ashs5yg.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Brandon Casey <casey@nrlssc.navy.mil> writes:
> >
> > But, I did not expect these to fetch tags:
> >
> >    git fetch <repo> <branch>:<branch>
> >    git pull <repo> <branch>:<branch>
> 
> Sigh... that matches my expectation.
> 
> Did we break it when we overhauled "git fetch", or was this an
> independent "improvement" that happened long before that?

I think during the git-fetch builtin marathon this got implemented, but probably as a feature masquerading as a bug fix and we didn't notice the regression.

The theory behind the expectation here is if we are fetching the object to a tracking ref then we probably want to watch it in the future. If we want to watch it and tag following was allowed, and we are missing a tag, we should follow the tag if we have the object graph under the tag complete.

Now what should:
	git pull <repo> <branch1>:<branch1> <branch2>

do, especially if <branch2> is referring to an object that you don't already have, that object also isn't reachable through <branch1>, but <branch2>^0 is the target of a tag <tag2> that you don't have? Should we get the tag anyway?

Personally I'd expect us to skip the tag pointing at <branch2>^0, based upon my description above, but I have a feeling we'd follow it anyway, as tag following was enabled and at least one item in the fetchspec provided asked for storage to a tracking ref and we have <tag2>^{} complete.

Of course even if we didn't follow that tag right away a future:
	git fetch <repo> <branch1>:<branch1>

might cause us to get the tag anyway, as <branch2>^0 is now reachable through HEAD, due to the implicit git-merge we ran above. ;-)

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 9 in “fetch <repo> <branch>:<branch> fetches tags?”
  1. Brandon CaseyJan 29, 2008
  2. Johannes SchindelinJan 29, 2008
  3. Brandon CaseyJan 29, 2008
  4. Junio C HamanoJan 29, 2008
  5. Shawn O. PearceJan 29, 2008
  6. Junio C HamanoJan 29, 2008
  7. Brandon CaseyJan 29, 2008
  8. Junio C HamanoJan 29, 2008
  9. Brandon CaseyJan 29, 2008

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.