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

Re: Question regarding git fetch

From
Jeff King <peff@peff.net>
Date
Aug 27, 2009, 21:39 UTC
Message-ID
<20090827213924.GE4399@coredump.intra.peff.net>
In-Reply-To
<7viqg9q7gx.fsf@alter.siamese.dyndns.org>
On Thu, Aug 27, 2009 at 02:20:46PM -0700, Junio C Hamano wrote:
Show 13 quoted lines
> I think it is reasonable, in 1.7.0, to change "git fetch" with command
> line refspacs that lack colon (i.e. saying "fetch this ref" without saying
> "and store it here") so that it updates remote tracking refs if and only
> if an appropriate remote.$remote.fetch is configured to do so.  E.g. when
> I fetch from Eric for git-svn updates with
> 
> 	$ git pull git-svn master
> 
> because I do have
> 
> 	[remote "git-svn"]
>                 url = git://yhbt.net/git-svn
>                 fetch = +refs/heads/*:refs/remotes/git-svn/*
Does the colon really matter? That is, should
  $ git fetch git-svn master
store a tracking ref, but
  $ git fetch git-svn master:foo

not? In both cases, git has learned during the course of an operation what the new value of the tracking ref could be, so why not store it?

The obstacle I see is that somebody may be using configured refspecs as something other than a tracking ref. That is, they care about _when_ those refs on the RHS of the refspec are updated, and are not treating them just as a cache of what the remote side has.

Show 11 quoted lines
> On the other hand, if my refspecs for "git svn" _were_ like this:
> 
> 	[remote "git-svn"]
> 		url = git://yhbt.net/git-svn
>                 fetch = +refs/heads/master:refs/remotes/git-svn/master
> 
> then I would _not_ want this:
> 
> 	$ git fetch git-svn dev
> 
> to create a new tracking branch refs/remotes/git-svn/dev.

Of course not. It's not in your configured refspec, so you have requested no such tracking ref. I think we would have to limit ourselves to how the tracking refs are defined in the refspecs. Otherwise how would we know to put the tracking ref in refs/remotes/git-svn and not some other place?

So I think it is a simple matter of applying the configured refspecs with information we happen to have gotten during the course of a somewhat-related operation.

-Peff
Previous: Junio C HamanoNext: Tom Lambda
Message 16 of 17 in “Question regarding git fetch”
  1. Tom LambdaAug 27, 2009
  2. Avery PennarunAug 27, 2009
  3. Eric RaibleAug 27, 2009
  4. Avery PennarunAug 27, 2009
  5. Björn SteinbrinkAug 27, 2009
  6. Avery PennarunAug 27, 2009
  7. Jeff KingAug 27, 2009
  8. Jeff KingAug 27, 2009
  9. Junio C HamanoAug 27, 2009
  10. Jeff KingAug 27, 2009
  11. Jeff KingAug 27, 2009
  12. Avery PennarunAug 27, 2009
  13. Jeff KingAug 27, 2009
  14. Avery PennarunAug 27, 2009
  15. Junio C HamanoAug 27, 2009
  16. Jeff KingAug 27, 2009
  17. Tom LambdaAug 28, 2009

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.