fix is_git detection when .git dir is located elsewhere
fix is_git detection when .git dir is located elsewhere

Summary:
The .git dir may be in a different location, and have .git be a text file that points to that dir.  This fixes is_git detection when the .git dir is somewhere else.

https://git-scm.com/docs/gitrepository-layout
Closes https://github.com/facebook/buck/pull/949

Reviewed By: Coneko

fbshipit-source-id: 4ca2fcb

JoelMarcey/buck,robbertvanginkel/buck,kageiit/buck,grumpyjames/buck,dsyang/buck,robbertvanginkel/buck,JoelMarcey/buck,Addepar/buck,shybovycha/buck,brettwooldridge/buck,SeleniumHQ/buck,justinmuller/buck,marcinkwiatkowski/buck,ilya-klyuchnikov/buck,daedric/buck,k21/buck,Addepar/buck,zhan-xiong/buck,k21/buck,zpao/buck,romanoid/buck,vschs007/buck,clonetwin26/buck,romanoid/buck,robbertvanginkel/buck,darkforestzero/buck,brettwooldridge/buck,darkforestzero/buck,clonetwin26/buck,ilya-klyuchnikov/buck,JoelMarcey/buck,k21/buck,k21/buck,justinmuller/buck,zhan-xiong/buck,brettwooldridge/buck,JoelMarcey/buck,k21/buck,JoelMarcey/buck,daedric/buck,dsyang/buck,illicitonion/buck,sdwilsh/buck,clonetwin26/buck,daedric/buck,daedric/buck,clonetwin26/buck,robbertvanginkel/buck,robbertvanginkel/buck,rmaz/buck,brettwooldridge/buck,grumpyjames/buck,shybovycha/buck,justinmuller/buck,JoelMarcey/buck,marcinkwiatkowski/buck,kageiit/buck,ilya-klyuchnikov/buck,sdwilsh/buck,nguyentruongtho/buck,Addepar/buck,clonetwin26/buck,SeleniumHQ/buck,clonetwin26/buck,SeleniumHQ/buck,rmaz/buck,justinmuller/buck,SeleniumHQ/buck,kageiit/buck,zpao/buck,dsyang/buck,zpao/buck,davido/buck,vschs007/buck,shybovycha/buck,zpao/buck,romanoid/buck,robbertvanginkel/buck,clonetwin26/buck,zhan-xiong/buck,robbertvanginkel/buck,rmaz/buck,grumpyjames/buck,k21/buck,brettwooldridge/buck,daedric/buck,zhan-xiong/buck,kageiit/buck,illicitonion/buck,sdwilsh/buck,dsyang/buck,JoelMarcey/buck,k21/buck,k21/buck,vschs007/buck,LegNeato/buck,facebook/buck,daedric/buck,vschs007/buck,darkforestzero/buck,ilya-klyuchnikov/buck,shs96c/buck,SeleniumHQ/buck,sdwilsh/buck,clonetwin26/buck,rmaz/buck,LegNeato/buck,brettwooldridge/buck,shs96c/buck,brettwooldridge/buck,brettwooldridge/buck,justinmuller/buck,darkforestzero/buck,zhan-xiong/buck,sdwilsh/buck,sdwilsh/buck,darkforestzero/buck,clonetwin26/buck,sdwilsh/buck,sdwilsh/buck,sdwilsh/buck,robbertvanginkel/buck,romanoid/buck,shybovycha/buck,vschs007/buck,k21/buck,ilya-klyuchnikov/buck,nguyentruongtho/buck,zhan-xiong/buck,LegNeato/buck,rmaz/buck,darkforestzero/buck,vschs007/buck,illicitonion/buck,rmaz/buck,shs96c/buck,LegNeato/buck,zhan-xiong/buck,romanoid/buck,shs96c/buck,justinmuller/buck,Addepar/buck,davido/buck,davido/buck,davido/buck,LegNeato/buck,justinmuller/buck,zhan-xiong/buck,shybovycha/buck,Addepar/buck,nguyentruongtho/buck,daedric/buck,marcinkwiatkowski/buck,JoelMarcey/buck,SeleniumHQ/buck,sdwilsh/buck,davido/buck,ilya-klyuchnikov/buck,davido/buck,vschs007/buck,clonetwin26/buck,kageiit/buck,Addepar/buck,rmaz/buck,romanoid/buck,nguyentruongtho/buck,LegNeato/buck,shs96c/buck,illicitonion/buck,shs96c/buck,JoelMarcey/buck,SeleniumHQ/buck,ilya-klyuchnikov/buck,daedric/buck,k21/buck,SeleniumHQ/buck,dsyang/buck,SeleniumHQ/buck,JoelMarcey/buck,illicitonion/buck,sdwilsh/buck,SeleniumHQ/buck,marcinkwiatkowski/buck,shybovycha/buck,LegNeato/buck,romanoid/buck,dsyang/buck,ilya-klyuchnikov/buck,brettwooldridge/buck,shybovycha/buck,Addepar/buck,Addepar/buck,grumpyjames/buck,romanoid/buck,justinmuller/buck,facebook/buck,shs96c/buck,justinmuller/buck,vschs007/buck,k21/buck,darkforestzero/buck,illicitonion/buck,shybovycha/buck,sdwilsh/buck,kageiit/buck,rmaz/buck,SeleniumHQ/buck,grumpyjames/buck,davido/buck,robbertvanginkel/buck,vschs007/buck,shybovycha/buck,facebook/buck,davido/buck,nguyentruongtho/buck,zhan-xiong/buck,shs96c/buck,JoelMarcey/buck,zpao/buck,robbertvanginkel/buck,Addepar/buck,brettwooldridge/buck,robbertvanginkel/buck,facebook/buck,LegNeato/buck,darkforestzero/buck,dsyang/buck,robbertvanginkel/buck,illicitonion/buck,facebook/buck,shs96c/buck,marcinkwiatkowski/buck,grumpyjames/buck,illicitonion/buck,shs96c/buck,k21/buck,zpao/buck,clonetwin26/buck,illicitonion/buck,dsyang/buck,grumpyjames/buck,grumpyjames/buck,shybovycha/buck,justinmuller/buck,brettwooldridge/buck,dsyang/buck,marcinkwiatkowski/buck,LegNeato/buck,romanoid/buck,sdwilsh/buck,illicitonion/buck,daedric/buck,Addepar/buck,marcinkwiatkowski/buck,LegNeato/buck,zhan-xiong/buck,romanoid/buck,daedric/buck,daedric/buck,romanoid/buck,clonetwin26/buck,illicitonion/buck,shs96c/buck,davido/buck,k21/buck,marcinkwiatkowski/buck,davido/buck,marcinkwiatkowski/buck,zhan-xiong/buck,rmaz/buck,grumpyjames/buck,darkforestzero/buck,vschs007/buck,LegNeato/buck,zpao/buck,kageiit/buck,davido/buck,darkforestzero/buck,illicitonion/buck,vschs007/buck,ilya-klyuchnikov/buck,vschs007/buck,illicitonion/buck,darkforestzero/buck,romanoid/buck,Addepar/buck,dsyang/buck,shs96c/buck,davido/buck,JoelMarcey/buck,ilya-klyuchnikov/buck,marcinkwiatkowski/buck,ilya-klyuchnikov/buck,shybovycha/buck,robbertvanginkel/buck,dsyang/buck,justinmuller/buck,nguyentruongtho/buck,Addepar/buck,vschs007/buck,SeleniumHQ/buck,grumpyjames/buck,shybovycha/buck,dsyang/buck,zhan-xiong/buck,facebook/buck,facebook/buck,LegNeato/buck,brettwooldridge/buck,justinmuller/buck,justinmuller/buck,marcinkwiatkowski/buck,daedric/buck,romanoid/buck,zhan-xiong/buck,rmaz/buck,ilya-klyuchnikov/buck,grumpyjames/buck,nguyentruongtho/buck,rmaz/buck,darkforestzero/buck,ilya-klyuchnikov/buck,marcinkwiatkowski/buck,darkforestzero/buck,daedric/buck,shs96c/buck,shybovycha/buck,rmaz/buck,grumpyjames/buck,clonetwin26/buck,brettwooldridge/buck,davido/buck,marcinkwiatkowski/buck,LegNeato/buck,dsyang/buck,Addepar/buck,rmaz/buck,SeleniumHQ/buck,JoelMarcey/buck