Use quotes to avoid unary operator error.
[git-central.git] / server / update-ensure-tag-in-branch
index f45f3ef..3c01543 100644 (file)
@@ -3,18 +3,20 @@
 # Tags should only be allowed to point to commits that are within a branch.
 #
 
+. $(dirname $0)/functions
+
 refname="$1"
 oldrev="$2"
 newrev="$3"
 
 # Only interested in tags
 case "$refname" in
-    refs/tags/*)
-        short_refname=${BASH_REMATCH[1]}
-        ;;
-    *)
-        exit 0
-        ;;
+       refs/tags/*)
+               short_refname=${refname##refs/tags/}
+               ;;
+       *)
+               exit 0
+               ;;
 esac
 
 # Except if they're getting deleted
@@ -24,11 +26,7 @@ fi
 
 contains=$(git branch --contains "$newrev" | wc -l)
 if [ $contains -eq 0 ] ; then
-       echo "----------------------------------------------------"
-       echo
-       echo "The tag $short_refname is not included in any branch."
-       echo
-       echo "----------------------------------------------------"
+       display_error_message "The tag $short_refname is not included in any branch."
        exit 1
 fi