From b117bd7366b38061ec91697f9f2c6d1736e01aa4 Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Wed, 4 Sep 2019 23:49:30 +0800 Subject: [PATCH] check git in bootstrap.py when trying to update submodule --- src/bootstrap/bootstrap.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 14bc90700b76e..65129eeeec504 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -708,6 +708,14 @@ def update_submodules(self): if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \ self.get_toml('submodules') == "false": return + + # check the existence of 'git' command + try: + subprocess.check_output(['git', '--version']) + except (subprocess.CalledProcessError, OSError): + print("error: `git` is not found, please make sure it's installed and in the path.") + sys.exit(1) + slow_submodules = self.get_toml('fast-submodules') == "false" start_time = time() if slow_submodules: