scripts/git/git-tag-update

38 lines
1.0 KiB
Plaintext
Raw Normal View History

2012-11-03 19:31:53 +01:00
#!/bin/sh
#
# git-tag-update, Copyright © 2012 Matteo Cypriani
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
# This script allows one to update a Git tag message while keeping its
# original date. The tag's author will be changed to whatever is the
# current author (you can change it temporarily with git config if you
# need to update commits with different authors).
set -e
#set -x
if [ $# -ne 1 ] ; then
2018-04-11 23:28:36 +02:00
echo "Usage: $0 <tag-name>" >&2
2012-11-03 19:31:53 +01:00
exit 1
fi
2018-04-11 23:28:36 +02:00
commiter_date()
{
git tag -v "$TAG" 2>/dev/null | grep ^tagger | cut -f5- -d' '
}
2012-11-03 19:31:53 +01:00
2018-04-11 23:28:36 +02:00
TAG="$1"
GIT_COMMITTER_DATE="$(commiter_date)"
2012-11-03 19:31:53 +01:00
export GIT_COMMITTER_DATE
2018-04-11 23:28:36 +02:00
git tag -sf "$TAG" "$TAG"
2012-11-03 19:31:53 +01:00
echo "Old tag commiter date: $GIT_COMMITTER_DATE"
2018-04-11 23:28:36 +02:00
GIT_COMMITTER_DATE="$(commiter_date)"
2012-11-03 19:31:53 +01:00
echo "New tag commiter date: $GIT_COMMITTER_DATE"