On Sun, Apr 11, 2010 at 12:12:33AM +0200, Paolo Bonzini wrote: > >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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html