Created
December 25, 2013 14:19
-
-
Save schnell18/8123560 to your computer and use it in GitHub Desktop.
This script converts lightweight tags migrated from Subversion to annotated tags. It also moves the tag to it parent commit which is identical to itself. This makes the git describe works as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Convert lightweight tag to annotated tag..." | |
for tg in $(git tag |grep REL) | |
do | |
newtag=${tg#REL_} | |
newtag=${newtag//_/.} | |
cmt=$(git log -1 --pretty=%s $tg) | |
tagger=$(git log -1 --pretty=%an $tg) | |
tagmail=$(git log -1 --pretty=%ae $tg) | |
tagdate=$(git log -1 --pretty=%ad $tg) | |
export GIT_COMMITTER_EMAIL=$tagmail | |
export GIT_COMMITTER_DATE=$tagdate | |
export GIT_COMMITTER_NAME=$tagger | |
dff=$(git diff $tg^ $tg) | |
if [[ -z $dff ]] | |
then | |
git tag -a -m "$cmt" $newtag $tg^ | |
else | |
git tag -a -m "$cmt" $newtag $tg | |
fi | |
git tag -d $tg | |
done | |
# vim: set ai nu nobk expandtab sw=4 ts=4 syntax=sh: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment