Some code cleanups in tree.c
Some code cleanups in tree.c

This replaces most of the explicit vector iteration with calls
to git_vector_foreach, adds in some git__free and giterr_clear
calls to clean up during some error paths, and a couple of
other code simplifications.

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