From 05bb844f125cfab236a5e93fda326fb019d6bcfa Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sun, 29 Oct 2017 00:07:50 -0400 Subject: [PATCH] Ignore ChangeLogs in NEWS * tools/gitlog-to-news: Account for ChangeLog entries in commit messages. --- tools/gitlog-to-news | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 }'