GITC: Fix 'repo start <branch> <repo>/<subdir>'
GITC: Fix 'repo start <branch> <repo>/<subdir>'

As soon as we wrote the gitc manifest, the folder for that repo became
empty, causing the next GetProjects lookup to fail. Reorder the
GetProjects calls so that they all happen while we still have the
repository contents available.

If you were already in a subdir, for cases like 'repo start <branch> .',
this would still fail, since the working directory would disappear out
from under you. That's fine most of the time, since we shouldn't be
doing operations based on the local directory, but git has a realpath
function that tries to restore CWD by chdir'ing back to it. So if the
working directory no longer exists, chdir to the topdir before
continuing.

Change-Id: Ibdf6cd37ff6e5a5f8338347c3919175491f7166f

qioixiy/git-repo,11NJ/git-repo,mer-tools/git-repo,aosp-mirror/tools_repo,chzhong/git-repo,nuclearmistake/repo,lipro-yocto/git-repo,chzhong/git-repo,wavecomp/git-repo,TheQtCompany/git-repo,couchbasedeps/git-repo,gabbayo/git-repo,mer-tools/git-repo,frogbywyplay/git-repo,dodocat/git-repo,testbetta/git-repo-pub,lewixliu/git-repo,codetutil/git-repo,GerritCodeReview/git-repo,dodocat/git-repo,gabbayo/git-repo,TheQtCompany/git-repo,frogbywyplay/git-repo,testbetta/git-repo-pub,GerritCodeReview/git-repo,jingyu/git-repo,couchbasedeps/git-repo,FlymeOS/repo,qioixiy/git-repo,chenzilin/git-repo,wavecomp/git-repo,nuclearmistake/repo,11NJ/git-repo,lipro-yocto/git-repo,testbetta/repo-pub,lewixliu/git-repo,FlymeOS/repo,testbetta/repo-pub,chenzilin/git-repo,aosp-mirror/tools_repo,jingyu/git-repo,codetutil/git-repo