Subject: Re: Status of all files

From: Paolo Bonzini <[email-masked]>
Date: Sun, 11 Apr 2010 00:12:33 +0200

On 04/09/2010 04:02 PM, Eric Raymond wrote:
>>> >  >
>>> >  >     'needs-update      The file has not been edited by the user, but there is
>>> >  >                        a more recent version on the current branch stored
>>> >  >                        in the master file.
>> >
>> >  Needs*update*  looks like it came from centralized VCS like CVS and
>> >  Subversion, where you use update-the-commit method.  You can't say
>> >  that HEAD version is more recent that working file...
>> >
>> >  The rought equivalent would be that upstream branch for current
>> >  branch (e.g. 'origin/master' can be upstream for 'master' branch) is
>> >  in fast-forward state i.e. current branch is direct ancestor of
>> >  corresponding upstream branch, and the file was modified upstream.
>
> 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.

Paolo