project.RemoteFetch: Handle depth cases more robustly
project.RemoteFetch: Handle depth cases more robustly

The fetch logic for the case where depth is set and revision is a
SHA1 has several failure modes that are not handled well by the
current logic.

1) 'git fetch <SHA1>' requires git version >= 1.8.3
2) 'git fetch <SHA1>' can be prevented by a configuration option on the server.
3) 'git fetch --depth=<N> <refspec>' can fail to contain a SHA1 specified by
   the manifest.

Each of these cases cause infinite recursion when _RemoteFetch() tries to call
itself with current_branch_only=False because current_branch_only is set to
True when depth != None.

To try to prevent the infinite recursion, we set self.clone_depth to None
before the first retry of _RemoteFetch(). This will allow the Fetch to
eventually succeed in the case where clone-depth is specified in the manifest.
A user specified depth from the init command will still recurse infinitely.

In addition, never try to fetch a SHA1 directly if the git version being used
is not at least 1.8.3.

Change-Id: I802fc17878c0929cfd63fff611633c1d3b54ecd3

testbetta/repo-pub,11NJ/git-repo,lewixliu/git-repo,lipro-yocto/git-repo,biaolv/git-repo,FuangCao/repo,jingyu/git-repo,lipro-yocto/git-repo,FuangCao/git-repo,darrengarvey/git-repo,petemoore/git-repo,kdavis-mozilla/repo-repo,zemug/repo,jingyu/git-repo,FlymeOS/repo,4455jkjh/repo,4455jkjh/repo,qioixiy/git-repo,testbetta/git-repo-pub,FlymeOS/repo,gabbayo/git-repo,mozilla/git-repo,couchbasedeps/git-repo,zemug/repo,chzhong/git-repo,chenzilin/git-repo,dodocat/git-repo,xyyangkun/git-repo,GerritCodeReview/git-repo,GerritCodeReview/git-repo,codetutil/git-repo,testbetta/git-repo-pub,aosp-mirror/tools_repo,ediTLJ/git-repo,dodocat/git-repo,frogbywyplay/git-repo,codetutil/git-repo,kdavis-mozilla/repo-repo,biaolv/git-repo,slfyusufu/repo,FuangCao/git-repo,nuclearmistake/repo,GatorQue/git-repo-flow,simbasailor/git-repo,iAlios/git-repo,mixedpuppy/git-repo,qioixiy/git-repo,ronan22/repo,CyanogenMod/tools_repo,iAlios/git-repo,mixedpuppy/git-repo,mozilla/git-repo,aosp-mirror/tools_repo,wavecomp/git-repo,FuangCao/repo,GatorQue/git-repo-flow,wavecomp/git-repo,ronan22/repo,TheQtCompany/git-repo,lewixliu/git-repo,mer-tools/git-repo,gabbayo/git-repo,mer-tools/git-repo,11NJ/git-repo,CyanogenMod/tools_repo,chenzilin/git-repo,chzhong/git-repo,simbasailor/git-repo,slfyusufu/repo,frogbywyplay/git-repo,nuclearmistake/repo,testbetta/repo-pub,petemoore/git-repo,xyyangkun/git-repo,darrengarvey/git-repo,gbraad/git-repo,ediTLJ/git-repo,couchbasedeps/git-repo,gbraad/git-repo,TheQtCompany/git-repo