diff --git a/tools/gitlog-to-news b/tools/gitlog-to-news index c70b909..ed163b5 100755 --- a/tools/gitlog-to-news +++ b/tools/gitlog-to-news @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Formats and concatenates long commit messages # # Copyright (C) 2012, 2013 Free Software Foundation, Inc. @@ -24,5 +24,18 @@ git log --log-size --format="%H%n%B" \ | grep -A1 '^log size \([5-9][0-9]\{2,\}\|[0-9]\{4,\}\)$' \ | grep -o '^[a-z0-9]\+$' \ | grep -vFf "${1:-/dev/null}" \ - | xargs -n1 git log -n1 --date=rfc --no-notes \ + | while read id; do + # try to account for ChangeLogs in commits + text=$( + git log -n1 --date=rfc --no-notes "$id" \ + | awk '/^ \* /{ exit } { print }' + ) + + # remember that four (or five, if merge) of these lines are the header + # (including empty line) + len=$( wc -l <<< "$text" ) + test "$len" -gt 10 || continue + + echo "$text" + done \ | awk '/^commit/ && NR!=1 { printf "\n\n" } { print }'