From 13078f413d11a0fe40491b003b5a7a50b18d231f Mon Sep 17 00:00:00 2001
From: Sam Gleske <sag47@drexel.edu>
Date: Fri, 22 Nov 2013 15:07:15 -0500
Subject: [PATCH] Updating SVN tags for bash best practices

---
 update_mirror.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/update_mirror.sh b/update_mirror.sh
index 094d9f3..0dae45c 100755
--- a/update_mirror.sh
+++ b/update_mirror.sh
@@ -37,11 +37,11 @@ if git config --get svn-remote.svn.url &> /dev/null;then
   git svn fetch
   git svn rebase
   git for-each-ref --format="%(objectname:short) %(refname)" refs/remotes/tags |  while read ref; do
-    objectname=$(echo ${ref} | cut -d " " -f 1)
-    tagname=$(echo ${ref} | cut -d " " -f 2 | cut -d / -f 4)
-    if ! git show-ref --tags | grep -E -q "refs/tags/${tagname}$"; then
+    tagname="${ref##*/}"
+    if ! git show-ref --tags | grep -q "refs/tags/${tagname}$"; then
       echo "Tag does not exist... creating it"
-      GIT_COMMITTER_DATE="$(git show --format=%aD  | head -1)" git tag -a ${tagname} -m "import '${tagname}' tag from svn" ${objectname}
+      objectname="${ref%% *}"
+      GIT_COMMITTER_DATE="$(git show --format=%aD  | head -1)" git tag -a "${tagname}" -m "import '${tagname}' tag from svn" "${objectname}"
     fi
   done
 
-- 
GitLab