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

Re: [PATCH 4/4] fetch: opportunistically update tracking refs

From
Jeff King <peff@peff.net>
Date
May 16, 2013, 03:37 UTC
Message-ID
<20130516033748.GC13296@sigill.intra.peff.net>
In-Reply-To
<87r4hcedra.fsf@linux-k42r.v.cablecom.net>
On Sun, May 12, 2013 at 11:41:45AM +0200, Thomas Rast wrote:
Show 16 quoted lines
> >> We miss an opportunity to update "refs/remotes/origin/master"
> >> (or whatever the user has configured). Some users find this
> >> confusing, because they would want to do further comparisons
> >> against the old state of the remote master, like:
> >>
> >>   $ git pull origin master
> >>   $ git log HEAD...origin/master
> >
> > I agree with the patch, but I would use a different reasoning. Your
> > example here is not even correct because the range in the second command
> > would be empty unless the merge conflicted.
> 
> Meh, I just read this again and saw that you actually had *three* dots.
> Serves me right for writing a reply on the phone.
> 
> So the quoted part is indeed correct.

Yes, it's correct, but it is a bit subtle. A better example would probably be:

  $ git status
  # On branch foo
  # Your branch is ahead of 'origin/master' by 2 commits.
  $ git pull origin master
  [pull 10 new commits]
  $ git status
  # On branch foo
  # Your branch is ahead of 'origin/master' by 13 commits.

That is technically true, but only because origin/master is now out of date. The more interesting number is 3: the two commits we had already, plus the new merge commit.

And of course there are infinite variations where you pull on one branch, and then switch branches to compare on another. But they all boil down to having an out-of-date view of origin/master that does not reflect the most recent pull.

-Peff
Previous: Thomas RastNext: Junio C Hamano
Message 9 of 12 in “update tracking refs on explicit fetch”
  1. 0/4 update tracking refs on explicit fetchJeff King, May 11, 2013
  2. 1/4 t5510: start tracking-ref tests from a known stateJeff King, May 11, 2013
  3. Eric SunshineMay 14, 2013
  4. 2/4 fetch/pull doc: untangle meaning of bare <ref>Jeff King, May 11, 2013
  5. 3/4 refactor "ref->merge" flagJeff King, May 11, 2013
  6. 4/4 fetch: opportunistically update tracking refsJeff King, May 11, 2013
  7. Thomas RastMay 12, 2013
  8. Thomas RastMay 12, 2013
  9. Jeff KingMay 16, 2013
  10. Junio C HamanoAug 6, 2013
  11. Jeff KingAug 6, 2013
  12. Junio C HamanoAug 6, 2013

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.