Fix shallow clone behavior
Fix shallow clone behavior

The existing code here makes sure that switching clone-depth from on to
off actually causes the history to be fully restored. Unfortunately, it
does this by fetching the full history every time the fetch spec
changes. Switching between two clone-depth="1" branches will fetch far
more than the top commit.

Instead, when not using clone-depth, pass --depth=2147483647 to git
fetch so that it ensures that we have the entire history. That is
slightly less efficient, so limit it to only when there are shallow
objects in the project by checking for the existance of the 'shallow'
file.

Change-Id: Iee0cfc9c6992c208344b1d9123769992412db67b

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