Add mkchangelog.sh script
authorBryn M. Reeves <bmr@redhat.com>
Wed, 14 Nov 2012 23:09:48 +0000 (23:09 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Wed, 14 Nov 2012 23:09:48 +0000 (23:09 +0000)
Add a script to generate ChangeLog from git-log

mkchangelog.sh [new file with mode: 0755]

diff --git a/mkchangelog.sh b/mkchangelog.sh
new file mode 100755 (executable)
index 0000000..fa9a5d5
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Convert git log to GNU-style ChangeLog file.
+# (C) Chris
+if test -d ".git"; then
+    git log --date-order \
+        --format="commit %H%nAuthor: %an %ae%nDate: %ad%n    %s%n" $@ | \
+    sed -e '/^commit.*$/d' | \
+    awk '/^Author/ {sub(/\\$/,""); getline t; print t $0; next}; 1' | \
+    sed -e 's/Author: //g' | \
+    sed -e 's/^Date:   \(.*\)/\* \1/g' | \
+    sed -e 's/\+0000//' -e 's/[0-9]\+\:[0-9]\+\:[0-9]\+ //' | \
+    sed -e 's/^\(.*\) \(\)\t\(.*\)/\3    \1    \2/g' | \
+    sed -e 's/^    /- /' -e 's/^$//'
+    exit 0
+else
+    echo "No git repository present."
+    exit 1
+fi