cmd/dist: improve isGitRepo to handle git "worktree"s
cmd/dist: improve isGitRepo to handle git "worktree"s

Simply checking the exit code of `git rev-parse --git-dir` should
suffice here, but that requires deviating from the infrastructure
provided by `run`, so I've left that for a future change.

Originally by Tamir Duberstein but updated by iant & rsc to add
the filepath.Join logic.

Fixes #11211 (again).

Change-Id: I6d29b5ae39ba456088ae1fb5d41014cb91c86897
Reviewed-on: https://go-review.googlesource.com/18323
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>

Cofyc/go,codestation/go,Samurais/go,mwhudson/go,theif519/go,golang/go,derekmarcotte/go,CAFxX/go,binarycrusader/go,vanloswang/go,miolini/go,theif519/go,suncycheng/go,miolini/go,Cofyc/go,ganboing/go-esx,vsekhar/elastic-go,4ad/go,josharian/go,goodlang/good,akutz/go,akutz/go,polyverse-security/go,CAFxX/go,akutz/go,derekmarcotte/go,momchil-velikov/go,momchil-velikov/go,sndnvaps/go,momchil-velikov/go,Samurais/go,nawawi/go,linux-on-ibm-z/go,vanloswang/go,mwhudson/go,miolini/go,vanloswang/go,goodlang/good,goodlang/good,codestation/go,linux-on-ibm-z/go,codestation/go,vsekhar/elastic-go,Endika/go,suncycheng/go,binarycrusader/go,binarycrusader/go,akutz/go,nawawi/go,ImJasonH/go,4ad/go,nawawi/go,polyverse-security/go,Samurais/go,Endika/go,linux-on-ibm-z/go,momchil-velikov/go,suncycheng/go,linux-on-ibm-z/go,derekmarcotte/go,cloudflare/go,sndnvaps/go,nawawi/go,cloudflare/go,codestation/go,josharian/go,ganboing/go-esx,derekmarcotte/go,cyberroadie/go,nawawi/go,nawawi/go,akutz/go,golang/go,4ad/go,ganboing/go-esx,momchil-velikov/go,suncycheng/go,vanloswang/go,derekmarcotte/go,Endika/go,mwhudson/go,Cofyc/go,momchil-velikov/go,Samurais/go,4ad/go,binarycrusader/go,cloudflare/go,cyberroadie/go,suncycheng/go,derekmarcotte/go,goodlang/good,theif519/go,cloudflare/go,polyverse-security/go,vanloswang/go,linux-on-ibm-z/go,golang/go,derekmarcotte/go,CAFxX/go,linux-on-ibm-z/go,goodlang/good,codestation/go,Endika/go,ganboing/go-esx,CAFxX/go,binarycrusader/go,Samurais/go,nawawi/go,CAFxX/go,ganboing/go-esx,ImJasonH/go,miolini/go,cyberroadie/go,josharian/go,suncycheng/go,josharian/go,Endika/go,akutz/go,vsekhar/elastic-go,CAFxX/go,polyverse-security/go,vsekhar/elastic-go,ImJasonH/go,vanloswang/go,theif519/go,sndnvaps/go,josharian/go,miolini/go,vsekhar/elastic-go,sndnvaps/go,Cofyc/go,Endika/go,sndnvaps/go,codestation/go,ImJasonH/go,goodlang/good,ganboing/go-esx,ImJasonH/go,Cofyc/go,sndnvaps/go,cyberroadie/go,suncycheng/go,cloudflare/go,ganboing/go-esx,nawawi/go,CAFxX/go,Samurais/go,mwhudson/go,christopher-henderson/Go,derekmarcotte/go,josharian/go,vsekhar/elastic-go,ImJasonH/go,theif519/go,vsekhar/elastic-go,momchil-velikov/go,akutz/go,suncycheng/go,cloudflare/go,binarycrusader/go,sndnvaps/go,golang/go,cyberroadie/go,linux-on-ibm-z/go,golang/go,polyverse-security/go,cyberroadie/go,binarycrusader/go,Endika/go,mwhudson/go,4ad/go,momchil-velikov/go,miolini/go,linux-on-ibm-z/go,polyverse-security/go,josharian/go,theif519/go,mwhudson/go,cyberroadie/go,codestation/go,sndnvaps/go,Endika/go,vanloswang/go,Samurais/go,golang/go,polyverse-security/go,ImJasonH/go,4ad/go,vsekhar/elastic-go,Samurais/go,golang/go,miolini/go,goodlang/good,cyberroadie/go,josharian/go,goodlang/good,codestation/go,akutz/go,miolini/go,cloudflare/go,polyverse-security/go,Cofyc/go,theif519/go,cloudflare/go,theif519/go,mwhudson/go,Cofyc/go,mwhudson/go,4ad/go,vanloswang/go,ganboing/go-esx,binarycrusader/go,Cofyc/go,CAFxX/go,4ad/go,ImJasonH/go,golang/go