#!/bin/sh

## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.


set -e

_MODE="$(basename ${0} | sed -e 's|^git-||' -e 's|-tag$||')"

_VERSION="${1}"
_HASH="${2}"

_TAG="$(echo ${_VERSION} | sed -e "s|^${_MODE}/||" -e 's|~|_|g')"

git tag -a -f -m "Tagging ${_MODE} version ${_VERSION}." ${_MODE}/${_TAG} ${_HASH}
