Skip to content

Commit

Permalink
add: git changelog gen script
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-burger committed Nov 30, 2024
1 parent 71185e9 commit 03ec955
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions git2debchangelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Convert git log into changelog in Debian format
#
# Tags in format 1.2.3-4 become version entries. Log entries between them
# become changelog entries. Merge commits are not excluded, so you probably
# have to clean up the result manually.

RE_VERSION='^v\?[0-9]\+\([.-][0-9]\+\)*'
# Assume the name of the current directory is the package name
PACKAGE=${PWD##*/}

function logentry() {
local previous=$1
local version=$2
echo "$PACKAGE ($version) unstable; urgency=low"
echo
git --no-pager log --format=" * %s" $previous${previous:+..}$version
echo
git --no-pager log --format=" -- %an <%ae> %aD" -n 1 $version
echo
}

git tag --sort "-version:refname" | grep -v beta | grep -v rev | grep "$RE_VERSION" | (
read version;

logentry $version master
while read previous; do
logentry $previous $version
version="$previous"
done
logentry "" $version
)

0 comments on commit 03ec955

Please sign in to comment.