gclient: have git operations specify the git dir by default
gclient: have git operations specify the git dir by default

If the .git/ subdir exists and mostly looks OK, but in reality git
doesn't accept it, gclient will blindly run git in the subdir and
think it's operating on the local .git/.  Kind of like:
  $ cd src/third_party/emoji-segmenter/src/
  $ rm -rf .git && mkdir .git
  # This works on the top level src/.git/.
  $ git <operation>

Instead of relying on this automatic git behavior, use GIT_DIR by
default so we force git to only look at that specific checkout.  If
it's broken, git will fail on us (good) instead of silently falling
back to the parent (bad).
  $ cd src/third_party/emoji-segmenter/src/
  $ rm -rf .git && mkdir .git
  $ GIT_DIR=$PWD/.git git <operation>
  <this now hard fails>

Bug: 1000825
Test: `gclient sync -j1` with a broken src/third_party/emoji-segmenter/src/.git/ caused the sync to halt
Change-Id: I777d67cd5daa354b32c424414d93a61b3b600f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1785957
Commit-Queue: Mike Frysinger <8f3f75c74bd5184edcfa6534cab3c13a00a2f794@chromium.org>
Reviewed-by: Edward Lesmes <d05609f027dc667cc37492b1dc1bdea5d60fa82a@chromium.org>

CoherentLabs/depot_tools,CoherentLabs/depot_tools