summaryrefslogtreecommitdiffstats
path: root/bin/git-debian-tag
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git-debian-tag')
-rwxr-xr-xbin/git-debian-tag19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/git-debian-tag b/bin/git-debian-tag
new file mode 100755
index 0000000..5afbc8c
--- /dev/null
+++ b/bin/git-debian-tag
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+if [ -n "$(git config --get user.signingKey)" ]
+then
+ GIT_OPTIONS="-s"
+else
+ GIT_OPTIONS="-a"
+fi
+
+MODE="$(basename ${0} | sed -e 's|^git-||' -e 's|-tag$||')"
+
+VERSION="${1}"
+HASH="${2}"
+
+TAG="$(echo ${VERSION} | sed -e "s|^${MODE}/||" -e 's|:|%|g' -e 's|~|_|g')"
+
+git tag ${GIT_OPTIONS} -f -m "Tagging ${MODE} version ${VERSION}." ${MODE}/${TAG} ${HASH}