Commit 58253865 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Node: Fix FetchDeps() being able to find git.bat on Windows

This is relevent for when the only "git" in your PATH is git.bat (from
depot_tools). I'd guess this is pretty common for Googlers.

Bug: v8:5960
Change-Id: I35bc49c6054afed20481ed408cfd02b7a4c346c8
Reviewed-on: https://chromium-review.googlesource.com/1019340
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52698}
parent 187c1e2a
......@@ -43,18 +43,21 @@ GCLIENT_SOLUTION = [
]
def EnsureGit(v8_path):
def git(args):
# shell=True needed on Windows to resolve git.bat.
return subprocess.check_output(
"git " + args, cwd=v8_path, shell=True).strip()
expected_git_dir = os.path.join(v8_path, ".git")
actual_git_dir = subprocess.check_output(
["git", "rev-parse", "--absolute-git-dir"], cwd=v8_path).strip()
actual_git_dir = git("rev-parse --absolute-git-dir")
if expected_git_dir == actual_git_dir:
print "V8 is tracked stand-alone by git."
return False
print "Initializing temporary git repository in v8."
subprocess.check_call(["git", "init"], cwd=v8_path)
subprocess.check_call(["git", "config", "user.name", "\"Ada Lovelace\""], cwd=v8_path)
subprocess.check_call(["git", "config", "user.email", "\"ada@lovela.ce\""], cwd=v8_path)
subprocess.check_call(["git", "commit", "--allow-empty", "-m", "init"],
cwd=v8_path)
git("init")
git("config user.name \"Ada Lovelace\"")
git("config user.email ada@lovela.ce")
git("commit --allow-empty -m init")
return True
def FetchDeps(v8_path):
......
......@@ -4,6 +4,7 @@
# found in the LICENSE file.
import os
import pipes
import shutil
import stat
import subprocess
......@@ -22,7 +23,10 @@ def EnsureDepotTools(v8_path, fetch_if_not_exist):
pass
if fetch_if_not_exist:
print "Checking out depot_tools."
subprocess.check_call(["git", "clone", DEPOT_TOOLS_URL, depot_tools])
# shell=True needed on Windows to resolve git.bat.
subprocess.check_call("git clone {} {}".format(
pipes.quote(DEPOT_TOOLS_URL),
pipes.quote(depot_tools)), shell=True)
return depot_tools
return None
depot_tools = _Get(v8_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment