#!/usr/bin/env sh

tag="$1"

# shellcheck disable=SC2312
if [ "$(git cat-file -t "${tag}")" != "commit" ]; then
  exit
fi

commit=$(git rev-list -n 1 "${tag}")
git tag --force --annotate "${tag}" --message="${tag}" "${commit}"
