Skip to content

Commit

Permalink
Make sure to get the last chronological tag, instead of relying on th…
Browse files Browse the repository at this point in the history
…e bogus `git tag` sorting.
  • Loading branch information
rauchg authored and tj committed Mar 27, 2011
1 parent 1304fdc commit 27e8049
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/git-changelog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ DATE=`date +'%Y-%m-%d'`
HEAD="\nn.n.n / $DATE \n==================\n"

if test "$1" = "--list"; then
version=`git tag | tail -n 1`
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
Expand All @@ -20,4 +21,4 @@ else
if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi
mv $tmp $CHANGELOG
test -n "$EDITOR" && $EDITOR $CHANGELOG
fi
fi

0 comments on commit 27e8049

Please sign in to comment.