#!/bin/sh
# Formats and concatenates long commit messages
#
#  Copyright (C) 2012, 2013 Free Software Foundation, Inc.
#
#  This file is part of GNU ease.js.
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
##

# format long commit messages
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 \
  | awk '/^commit/ && NR!=1 { printf "\n\n" } { print }'
