From 8e2fe6449ef83462d05e59d9d8744a088fadfe9a Mon Sep 17 00:00:00 2001 From: cloudhead Date: Wed, 4 Dec 2024 12:40:10 +0100 Subject: [PATCH] scripts: Improve changelog script * Add number of commits and contributors * Default to the latest version tag as the "current" --- scripts/changelog | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/changelog b/scripts/changelog index 41832089..5adb2ca1 100755 --- a/scripts/changelog +++ b/scripts/changelog @@ -23,8 +23,8 @@ while [ $# -gt 0 ]; do done # Current/latest tag. -tag=$(git describe) -version=$(echo $tag | sed 's/^v//') +current=$(git describe --tags --match='v*' --abbrev=0) +version=$(echo $current | sed 's/^v//') if [ -z "$from" ]; then previous="$(git describe --abbrev=0 HEAD^)" @@ -52,9 +52,15 @@ echo echo "* This update is recommended for everyone. No manual intervention is required." echo echo "## Changelog" + +ncommits=$(git rev-list --count $previous..$current) +ncontribs=$(git log $previous..HEAD --format='%ae' | sort -u | wc -l) + +echo +echo "This release contains $ncommits commit(s) by $ncontribs contributor(s)." echo -git log --pretty=format:'* `%h` **%s** *<%ae>*' $previous..HEAD +git log --pretty=format:'* `%h` **%s** *<%ae>*' $previous..$current echo echo "## Checksums"