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

Re: Status of all files

From
Jeff King <peff@peff.net>
Date
Apr 11, 2010, 10:25 UTC
Message-ID
<20100411102534.GC20484@coredump.intra.peff.net>
In-Reply-To
<4BC0F7D1.6000003@gnu.org>
On Sun, Apr 11, 2010 at 12:12:33AM +0200, Paolo Bonzini wrote:
Show 25 quoted lines
> >Agreed. But there's no way to tell that this is the case without
> >doing a pull operation or otherwise querying origin, and I'm
> >not going to do that.
> 
> You can query the origin _as it was on the last fetch_.
> 
> If you are on branch X, the logic is as follows:
> 
> - Let R be the value of configuration key branch.X.remote,
> - let M be the value of configuration key branch.X.merge,
> - for all values S of configuration key remote.R.fetch,
>   - strip an initial +
>   - if S is M:N, return N
>   - if S is P/*:Q/* where P is a prefix of M, take M, replace this
>     prefix with Q and return the result
> 
> In the most common case you will have:
> 
> - X = master
> - R = origin
> - M = refs/heads/master
> - one key S = +refs/heads/*:refs/remotes/origin/*
> 
> so the prefix "refs/heads/" is replaced with "refs/remotes/origin/"
> and the result is refs/remotes/origin/master.

BTW, this procedure is complex enough that we have exposed it via a plumbing interface:

  $ git for-each-ref --format='%(upstream)' refs/heads/master
  refs/remotes/origin/master
which does all of the correct magic internally.
-Peff
Previous: Paolo BonziniNext: Ramkumar Ramachandra
Message 14 of 19 in “How can I tell if a file is ignored by git?”
  1. Eric RaymondApr 9, 2010
  2. Jacob HelwigApr 9, 2010
  3. Status of all files (was: Re: How can I tell if a file is ignored by git?Eric Raymond, Apr 9, 2010
  4. Randal L. SchwartzApr 9, 2010
  5. Eric RaymondApr 9, 2010
  6. Junio C HamanoApr 10, 2010
  7. Jakub NarebskiApr 9, 2010
  8. Eric RaymondApr 9, 2010
  9. Matthieu MoyApr 9, 2010
  10. Eric RaymondApr 9, 2010
  11. Junio C HamanoApr 9, 2010
  12. Jakub NarebskiApr 9, 2010
  13. Paolo BonziniApr 10, 2010
  14. Jeff KingApr 11, 2010
  15. Ramkumar RamachandraApr 9, 2010
  16. Ævar Arnfjörð BjarmasonApr 9, 2010
  17. Eric RaymondApr 9, 2010
  18. Daniel GraceApr 9, 2010
  19. Eric RaymondApr 10, 2010

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.