• Mike Frysinger's avatar
    gclient: have git operations specify the git dir by default · 286fb160
    Mike Frysinger authored
    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 <vapier@chromium.org>
    Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
    286fb160
gclient_scm.py 60.8 KB