summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2012-06-05 07:55:07 -0700
committerShawn O. Pearce <sop@google.com>2012-06-05 07:56:09 -0700
commit4fd38ecc3ae6ce004b59ffe6545918495080e165 (patch)
tree130140de974400ce213b76b5814b36b40f819e38
parent9fae805e0421aa4caf1e0a9052f8701a88d7bd0d (diff)
downloadgit-repo-4fd38ecc3ae6ce004b59ffe6545918495080e165.tar.gz
Detect git is not installed
Fix detection for Git not being in $PATH during the initial run of `repo init` in a new directory. Change-Id: I2b1fcce1fb8afc47271f5c3bd2a28369009b2fb7
-rwxr-xr-xrepo14
1 files changed, 12 insertions, 2 deletions
diff --git a/repo b/repo
index 860a15d5..05d4455d 100755
--- a/repo
+++ b/repo
@@ -28,7 +28,7 @@ if __name__ == '__main__':
28del magic 28del magic
29 29
30# increment this whenever we make important changes to this script 30# increment this whenever we make important changes to this script
31VERSION = (1, 16) 31VERSION = (1, 17)
32 32
33# increment this if the MAINTAINER_KEYS block is modified 33# increment this if the MAINTAINER_KEYS block is modified
34KEYRING_VERSION = (1,0) 34KEYRING_VERSION = (1,0)
@@ -220,7 +220,17 @@ def _Init(args):
220 220
221def _CheckGitVersion(): 221def _CheckGitVersion():
222 cmd = [GIT, '--version'] 222 cmd = [GIT, '--version']
223 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) 223 try:
224 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
225 except OSError, e:
226 print >>sys.stderr
227 print >>sys.stderr, "fatal: '%s' is not available" % GIT
228 print >>sys.stderr, 'fatal: %s' % e
229 print >>sys.stderr
230 print >>sys.stderr, 'Please make sure %s is installed'\
231 ' and in your path.' % GIT
232 raise CloneFailure()
233
224 ver_str = proc.stdout.read().strip() 234 ver_str = proc.stdout.read().strip()
225 proc.stdout.close() 235 proc.stdout.close()
226 proc.wait() 236 proc.wait()