From 62659df7e26ce25e5d6f8d84dbece7931b5a4669 Mon Sep 17 00:00:00 2001
From: Pablo Escobar <pescobar001@gmail.com>
Date: Mon, 20 Mar 2017 12:18:00 +0100
Subject: [PATCH] added sanity check to be sure the cloned branch exists

---
 scripts/ost-nightly-build.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/ost-nightly-build.sh b/scripts/ost-nightly-build.sh
index f6e79c2ae..dd24e58aa 100644
--- a/scripts/ost-nightly-build.sh
+++ b/scripts/ost-nightly-build.sh
@@ -30,6 +30,15 @@ echo "cloning the OST code: $GIT_BRANCH branch"
 echo -e "running $git_cmd"
 $git_cmd
 
+# sanity check to verify that the cloned branch exists
+cd $TEMP_DIR/openstructure
+git checkout $GIT_BRANCH
+if [[ $? != 0 ]]; then
+	echo -e "\ngit branch $GIT_BRANCH not found in cloned repository. Are you sure this is an existing branch?" 
+	echo -e "Aborting.... \n" 
+	exit 1
+fi
+
 # fetch the latest git commit ID. We will use this in the module name together with the branch name
 cd $TEMP_DIR/openstructure
 LATEST_COMMIT=`git rev-parse HEAD | cut -c1-8`
-- 
GitLab