From cfb0d15aad7ed5564e62c1d4101cddfeee648a5f Mon Sep 17 00:00:00 2001 From: Camille Reynders Date: Thu, 3 May 2012 14:03:48 +0200 Subject: [PATCH 1/4] added git-rename-tag --- bin/git-rename-tag | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bin/git-rename-tag diff --git a/bin/git-rename-tag b/bin/git-rename-tag new file mode 100644 index 0000000..8b6bcab --- /dev/null +++ b/bin/git-rename-tag @@ -0,0 +1,9 @@ +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 $old $new +git tag -d $old +git push origin :refs/tag/$old \ No newline at end of file From b91534b234c6bfb2d9837c1ed9b60e96fb0888a5 Mon Sep 17 00:00:00 2001 From: Camille Reynders Date: Thu, 3 May 2012 14:23:07 +0200 Subject: [PATCH 2/4] fixed incorrect argument passing and added pushing to remote --- bin/git-rename-tag | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 bin/git-rename-tag diff --git a/bin/git-rename-tag b/bin/git-rename-tag old mode 100644 new mode 100755 index 8b6bcab..5fb852d --- a/bin/git-rename-tag +++ b/bin/git-rename-tag @@ -4,6 +4,7 @@ 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 $old $new +git tag $new $old git tag -d $old +git push origin $new git push origin :refs/tag/$old \ No newline at end of file From 0e97b5f9a0788a863f5abd77a4a7d26906673f0f Mon Sep 17 00:00:00 2001 From: Camille Reynders Date: Thu, 3 May 2012 19:24:43 +0200 Subject: [PATCH 3/4] git-changelog accepts optional parameter to pass changelog output file --- bin/git-changelog | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/git-changelog b/bin/git-changelog index 62a29ca..912c46f 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -1,7 +1,5 @@ #!/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" @@ -14,6 +12,11 @@ if test "$1" = "--list"; then git log --pretty="format: * %s" $version.. fi else + 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 From 1914503d2f27939f1f08e5ffb7b4b20d9ea7e46c Mon Sep 17 00:00:00 2001 From: Camille Reynders Date: Thu, 3 May 2012 19:27:58 +0200 Subject: [PATCH 4/4] added switch -l as shortcut for --list to git-changelog --- bin/git-changelog | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/bin/git-changelog b/bin/git-changelog index 912c46f..28cda0e 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -3,25 +3,28 @@ 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 - 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 -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 \ No newline at end of file