diff --git a/git-retag.sh b/git-retag.sh index e7556e1..b7079f7 100755 --- a/git-retag.sh +++ b/git-retag.sh @@ -4,13 +4,14 @@ # $2 = Organisation (smeserver or smecontrib)e # optional (can be in any order) # will use parameters set for local repository else it will use remote +# will purge all old tags # turn on debug regardless of ~/.smegit/config # print a line showing how it was called # Module name must exist # if [[ -z $1 ]] ; then - echo "************git-retag.sh [ | ]" + echo "************git-retag.sh [ | | | ]" exit 0 fi @@ -31,7 +32,7 @@ if [ ! -e $inifilename ] ; then # Not here, look at system default if [ ! -e /etc/smegit.ini ] ; then echo "No ini file found $inifiename or /etc/smegit.ini" - echo "git-retag.sh [ | ]" + echo "git-retag.sh [ | | | ]" exit 1 else initfilename="/etc/smegit.ini" @@ -75,7 +76,7 @@ for param in $3 $4 $5 $6 ; do DEBUG=true ;; noisy ) NOISY=true ;; - clean ) + purge ) CLEAN=true ;; * ) echo "Unkown parameter: $param" @@ -147,6 +148,7 @@ if [ $CLEAN ] ; then OLDTAGS=$(git tag --list) # delete old tag/s for tag in $OLDTAGS ; do + if [ $DEBUG ] ; then echo "Removing tag $tag" ; fi git tag --delete $tag git push origin --delete $tag git push --tags @@ -156,6 +158,7 @@ fi VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec` VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*} VERSION=${VERSION_RELEASE% *} +VERSION=${VERSION//./_} RELEASE=${VERSION_RELEASE#* } TAG=$VERSION"-"${RELEASE%.*} if [ $DEBUG ] ; then @@ -168,5 +171,6 @@ git pull git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG" git push origin --tag $TAG $QUIET -echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG - old tags removed" +echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG" +if [ $CLEAN ] ; then echo " - old tags removed" ; fi exit 0