On 09/04/13 00:24, Pavel Sanda wrote:
> Tommaso Cucinotta wrote:
>> Yes, but the problem is that the ::findFile() machinery is called twice
> 
> Which is a mistake, we used to call it only once. Unfortuntaly both
> me and Georg is short of time so it will perhaps take some time to address
> all the mess which seem to be in 2.1 VCS.
> I think the correct order is
> - fix architecture (findFile only once)
> - fix error checking (seems that error redirection has been rewritten in 
> support/ and VCS code was broken as you indicated)
> - fix broken git status and checkout file from repo (this thread)

Ok, really really wanting to use git status --porcelain, we can go for the 
following (but I hate it).
Let me write it in shell code:

gitout=$(git-status --porcelain $file)"
if  [ -f $file ]; then
  if [ "$gitout" == "" ]; then
    // ON REPO
  elif [ "$gitout" == "M $file" ]; then
    // ON REPO, MODIFIED
  elif [ "$gitout" == "?? $file" ]; then
    // NOT ON REPO
  else
    // ??!?
  fi
else
  if [ "$gitout" == "" ]; then
    // NOT ON REPO
  elif [ "$gitout" == "D $file" ]; then
    // ON REPO, DELETED from local FS
  else
    // ??!?
  fi
fi

But again, git ls-files seems WAY EASIER.

        T.

Reply via email to