Fix some submodule and typechange checkout cases
Fix some submodule and typechange checkout cases

There were a bunch of small bugs in the checkout code where I was
assuming that a typechange was always from a tree to a blob or
vice versa.  This fixes up most of those cases.  Also, there were
circumstances where the submodule definitions were changed by the
checkout and the submodule data was not getting reloaded properly
before the new submodules were checked out.

maxiaoqian/libgit2,jeffhostetler/public_libgit2,JIghtuse/libgit2,yosefhackmon/libgit2,rcorre/libgit2,since2014/libgit2,rcorre/libgit2,linquize/libgit2,yosefhackmon/libgit2,kissthink/libgit2,kenprice/libgit2,whoisj/libgit2,t0xicCode/libgit2,oaastest/libgit2,dleehr/libgit2,Snazz2001/libgit2,mrksrm/Mingijura,claudelee/libgit2,mhp/libgit2,yosefhackmon/libgit2,kissthink/libgit2,leoyanggit/libgit2,saurabhsuniljain/libgit2,kissthink/libgit2,dleehr/libgit2,leoyanggit/libgit2,mingyaaaa/libgit2,MrHacky/libgit2,jflesch/libgit2-mariadb,t0xicCode/libgit2,yongthecoder/libgit2,kissthink/libgit2,jeffhostetler/public_libgit2,oaastest/libgit2,raybrad/libit2,sygool/libgit2,jeffhostetler/public_libgit2,KTXSoftware/libgit2,ardumont/libgit2,nokiddin/libgit2,sygool/libgit2,linquize/libgit2,joshtriplett/libgit2,Corillian/libgit2,mcanthony/libgit2,mrksrm/Mingijura,Snazz2001/libgit2,maxiaoqian/libgit2,swisspol/DEMO-libgit2,jamieleecool/ptest,swisspol/DEMO-libgit2,Tousiph/Demo1,JIghtuse/libgit2,t0xicCode/libgit2,Corillian/libgit2,saurabhsuniljain/libgit2,mcanthony/libgit2,rcorre/libgit2,whoisj/libgit2,sygool/libgit2,MrHacky/libgit2,magnus98/TEST,chiayolin/libgit2,whoisj/libgit2,sygool/libgit2,mhp/libgit2,zodiac/libgit2.js,mrksrm/Mingijura,JIghtuse/libgit2,Tousiph/Demo1,iankronquist/libgit2,since2014/libgit2,falqas/libgit2,kenprice/libgit2,iankronquist/libgit2,chiayolin/libgit2,Snazz2001/libgit2,sim0629/libgit2,whoisj/libgit2,magnus98/TEST,spraints/libgit2,jamieleecool/ptest,jflesch/libgit2-mariadb,magnus98/TEST,amyvmiwei/libgit2,ardumont/libgit2,jamieleecool/ptest,mingyaaaa/libgit2,oaastest/libgit2,sim0629/libgit2,Corillian/libgit2,nokiddin/libgit2,Aorjoa/libgit2_maked_lib,joshtriplett/libgit2,rcorre/libgit2,jflesch/libgit2-mariadb,yongthecoder/libgit2,mcanthony/libgit2,kissthink/libgit2,swisspol/DEMO-libgit2,joshtriplett/libgit2,jflesch/libgit2-mariadb,Corillian/libgit2,KTXSoftware/libgit2,linquize/libgit2,oaastest/libgit2,skabel/manguse,swisspol/DEMO-libgit2,Corillian/libgit2,KTXSoftware/libgit2,ardumont/libgit2,Tousiph/Demo1,chiayolin/libgit2,joshtriplett/libgit2,leoyanggit/libgit2,linquize/libgit2,sygool/libgit2,Tousiph/Demo1,iankronquist/libgit2,sim0629/libgit2,skabel/manguse,skabel/manguse,claudelee/libgit2,dleehr/libgit2,spraints/libgit2,nokiddin/libgit2,MrHacky/libgit2,magnus98/TEST,sim0629/libgit2,chiayolin/libgit2,spraints/libgit2,KTXSoftware/libgit2,amyvmiwei/libgit2,Snazz2001/libgit2,iankronquist/libgit2,oaastest/libgit2,skabel/manguse,Tousiph/Demo1,yongthecoder/libgit2,yosefhackmon/libgit2,evhan/libgit2,Snazz2001/libgit2,MrHacky/libgit2,falqas/libgit2,Aorjoa/libgit2_maked_lib,zodiac/libgit2.js,raybrad/libit2,spraints/libgit2,stewid/libgit2,iankronquist/libgit2,t0xicCode/libgit2,amyvmiwei/libgit2,nokiddin/libgit2,maxiaoqian/libgit2,evhan/libgit2,Aorjoa/libgit2_maked_lib,kenprice/libgit2,zodiac/libgit2.js,mrksrm/Mingijura,since2014/libgit2,Aorjoa/libgit2_maked_lib,dleehr/libgit2,saurabhsuniljain/libgit2,swisspol/DEMO-libgit2,claudelee/libgit2,t0xicCode/libgit2,iankronquist/libgit2,leoyanggit/libgit2,claudelee/libgit2,chiayolin/libgit2,amyvmiwei/libgit2,stewid/libgit2,skabel/manguse,since2014/libgit2,jamieleecool/ptest,leoyanggit/libgit2,amyvmiwei/libgit2,saurabhsuniljain/libgit2,nokiddin/libgit2,zodiac/libgit2.js,ardumont/libgit2,raybrad/libit2,yosefhackmon/libgit2,whoisj/libgit2,since2014/libgit2,Snazz2001/libgit2,stewid/libgit2,evhan/libgit2,stewid/libgit2,ardumont/libgit2,mrksrm/Mingijura,yosefhackmon/libgit2,mingyaaaa/libgit2,falqas/libgit2,JIghtuse/libgit2,whoisj/libgit2,swisspol/DEMO-libgit2,since2014/libgit2,kenprice/libgit2,raybrad/libit2,saurabhsuniljain/libgit2,falqas/libgit2,falqas/libgit2,joshtriplett/libgit2,claudelee/libgit2,falqas/libgit2,spraints/libgit2,yongthecoder/libgit2,jflesch/libgit2-mariadb,mingyaaaa/libgit2,dleehr/libgit2,claudelee/libgit2,joshtriplett/libgit2,yongthecoder/libgit2,sim0629/libgit2,zodiac/libgit2.js,dleehr/libgit2,mhp/libgit2,linquize/libgit2,mcanthony/libgit2,mingyaaaa/libgit2,Corillian/libgit2,sim0629/libgit2,leoyanggit/libgit2,mrksrm/Mingijura,rcorre/libgit2,mingyaaaa/libgit2,jeffhostetler/public_libgit2,kenprice/libgit2,Tousiph/Demo1,ardumont/libgit2,raybrad/libit2,JIghtuse/libgit2,maxiaoqian/libgit2,sygool/libgit2,rcorre/libgit2,skabel/manguse,stewid/libgit2,jeffhostetler/public_libgit2,MrHacky/libgit2,KTXSoftware/libgit2,stewid/libgit2,jeffhostetler/public_libgit2,amyvmiwei/libgit2,linquize/libgit2,magnus98/TEST,mcanthony/libgit2,kenprice/libgit2,JIghtuse/libgit2,mhp/libgit2,chiayolin/libgit2,kissthink/libgit2,mcanthony/libgit2,maxiaoqian/libgit2,saurabhsuniljain/libgit2,t0xicCode/libgit2,mhp/libgit2,evhan/libgit2,jflesch/libgit2-mariadb,spraints/libgit2,Aorjoa/libgit2_maked_lib,yongthecoder/libgit2,magnus98/TEST,KTXSoftware/libgit2,nokiddin/libgit2,mhp/libgit2,MrHacky/libgit2,oaastest/libgit2,maxiaoqian/libgit2