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 |