From 566625e37565bda3867866655fc3eeb1dcce1f66 Mon Sep 17 00:00:00 2001
From: Sam Gleske <sag47@drexel.edu>
Date: Mon, 7 Oct 2013 13:59:53 -0400
Subject: [PATCH] Update_mirror offline gitlab cron fix

If run in a cron job and gitlab is off-line update_mirror.sh
would turn the SVN repository into a bare repository.  This
then breaks the SVN mirror until bare is set back to false.
---
 update_mirror.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/update_mirror.sh b/update_mirror.sh
index 935815f..073d75d 100755
--- a/update_mirror.sh
+++ b/update_mirror.sh
@@ -37,7 +37,13 @@ if git config --get svn-remote.svn.url &> /dev/null;then
   git svn rebase
   cd .git
   git config --bool core.bare true
-  git push gitlab
+  #bug fix for when gitlab is off-line during a cron job the bare setting gets set back to false when the git command fails
+  set +e
+  if ! git push gitlab;then
+    git config --bool core.bare false
+    exit 1
+  fi
+  set -e
   git config --bool core.bare false
 else
   #just a git mirror so mirror it accordingly
-- 
GitLab