Permalink
Browse files

Merge pull request #99 from creynders/master

modified changelog and added rename-tag
  • Loading branch information...
tj committed May 3, 2012
2 parents a490554 + f6ac845 commit 785f546f689ffdf4d9f9a7422142bdf4961637ab
Showing with 35 additions and 19 deletions.
  1. +25 −19 bin/git-changelog
  2. +10 −0 bin/git-rename-tag
View
@@ -1,24 +1,30 @@
#!/bin/sh
-CHANGELOG=`ls | egrep 'change|history' -i`
-if test "$CHANGELOG" = ""; then CHANGELOG='History.md'; fi
DATE=`date +'%Y-%m-%d'`
HEAD="\nn.n.n / $DATE \n==================\n\n"
-if test "$1" = "--list"; then
- version=`git for-each-ref refs/tags --sort=-authordate --format='%(refname)' \
- --count=1 | sed 's/^refs\/tags\///'`
- if test -z "$version"; then
- git log --pretty="format: * %s"
- else
- git log --pretty="format: * %s" $version..
- fi
-else
- tmp="/tmp/changelog"
- printf "$HEAD" > $tmp
- git-changelog --list >> $tmp
- printf '\n' >> $tmp
- if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi
- mv $tmp $CHANGELOG
- test -n "$EDITOR" && $EDITOR $CHANGELOG
-fi
+case "$1" in
+ -l|--list)
+ version=`git for-each-ref refs/tags --sort=-authordate --format='%(refname)' \
+ --count=1 | sed 's/^refs\/tags\///'`
+ if test -z "$version"; then
+ git log --pretty="format: * %s"
+ else
+ git log --pretty="format: * %s" $version..
+ fi
+ ;;
+ *)
+ CHANGELOG=$1
+ if test "$CHANGELOG" = ""; then
+ CHANGELOG=`ls | egrep 'change|history' -i`
+ if test "$CHANGELOG" = ""; then CHANGELOG='History.md'; fi
+ fi
+ tmp="/tmp/changelog"
+ printf "$HEAD" > $tmp
+ git-changelog --list >> $tmp
+ printf '\n' >> $tmp
+ if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi
+ mv $tmp $CHANGELOG
+ test -n "$EDITOR" && $EDITOR $CHANGELOG
+ ;;
+esac
View
@@ -0,0 +1,10 @@
+old=$1
+new=$2
+
+test -z $old && echo "old tag name required." 1>&2 && exit 1
+test -z $new && echo "new tag name required." 1>&2 && exit 1
+
+git tag $new $old
+git tag -d $old
+git push origin $new
+git push origin :refs/tag/$old

0 comments on commit 785f546

Please sign in to comment.