Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: gclient

Issue 518064: Check for the existence of git before running commands (Closed)
Patch Set: Fixed whitespace issues Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient
diff --git a/gclient b/gclient
index c377660002139b035e80eabda508db00a2b874d4..aeb648ecec16acac993c15d9a9cef51f7f6b4ccf 100755
--- a/gclient
+++ b/gclient
@@ -7,14 +7,50 @@
base_dir=$(dirname "$0")
+# Test git and git --version.
+function test_git {
+ echo -n "Trying git... "
+ local GITV="$(git --version)" || {
+ echo "git isn't installed, please install it"
+ exit 1
+ }
+
+ GITV="${GITV##* }" # Only examine last word (i.e. version number)
+ local GITD=( ${GITV//./ } ) # Split version number into decimals
+ if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
+ echo "git version is ${GITV}, please update to a version later than 1.6"
+ exit 1
+ fi
+}
+
+# Test git svn and git svn --version.
+function test_git_svn {
+ echo -n "Trying git-svn... "
M-A Ruel 2010/01/08 01:12:43 Actually, after trying the patch, I don't want thi
+ local GITV="$(git svn --version)" || {
+ echo "git-svn isn't installed, please install it"
+ exit 1
+ }
+
+ GITV="${GITV#* version }" # git svn --version has extra output to remove.
+ GITV="${GITV% (svn*}"
+ local GITD=( ${GITV//./ } ) # Split version number into decimals
+ if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
+ echo "git version is ${GITV}, please update to a version later than 1.6"
+ exit 1
+ fi
+}
+
+
# Update git checkouts prior the cygwin check, we don't want to use msysgit.
if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ]
then
+ test_git_svn
(cd "$base_dir"; git svn rebase -q -q)
fi
if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/git-cl-repo/.git" ]
then
+ test_git
(cd "$base_dir/git-cl-repo"; git pull -q)
fi
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698