From 01539587194321e513c30d35c1960acd58866c73 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 1 May 2016 19:42:44 +0300
Subject: In ci scripts add also protection against git clone failures.

---
 tools/ci/jobs/mplint.sh  |  2 +-
 tools/ci/scripts/init.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/tools/ci/jobs/mplint.sh b/tools/ci/jobs/mplint.sh
index da824c985..c6ca9543d 100755
--- a/tools/ci/jobs/mplint.sh
+++ b/tools/ci/jobs/mplint.sh
@@ -13,7 +13,7 @@ export CXXFLAGS="-std=gnu++11"
 
 do_init
 
-git clone https://gitlab.com/manaplus/mplint.git
+gitclone https://gitlab.com/manaplus/mplint.git
 cd mplint
 run_configure_simple
 run_make
diff --git a/tools/ci/scripts/init.sh b/tools/ci/scripts/init.sh
index 64e11f3b0..7f48bb0aa 100755
--- a/tools/ci/scripts/init.sh
+++ b/tools/ci/scripts/init.sh
@@ -67,6 +67,35 @@ function aptget_install {
     fi
 }
 
+function gitclone {
+    git clone $*
+    if [ "$?" != 0 ]; then
+        sleep 1s
+        git clone $*
+        if [ "$?" != 0 ]; then
+            sleep 3s
+            git clone $*
+            if [ "$?" != 0 ]; then
+                sleep 5s
+                git clone $*
+                if [ "$?" != 0 ]; then
+                    sleep 10s
+                    git clone $*
+                    if [ "$?" != 0 ]; then
+                        sleep 15s
+                        git clone $*
+                        if [ "$?" != 0 ]; then
+                            sleep 20s
+                            git clone $*
+                        fi
+                    fi
+                fi
+            fi
+        fi
+    fi
+    check_error $?
+}
+
 function check_error {
     if [ "$1" != 0 ]; then
         cat $ERRFILE
-- 
cgit v1.2.3-70-g09d2