#!/bin/bash

# pre-fill the ooo-build commit message

if [ "$2,$3" = "," ] ; then
    cp "$1" "$1.prepare"

    echo -e '\n' > "$1"

    git diff --cached --name-status -r | sed 's/^.\t\(.*\)/* \1: /' >> "$1"

    cat <<EOF >>"$1"

# The first line should generally describe the change.
#
# Then an empty line, followed by a longer description if needed,
# like here.
#
# * patches/dev300/something.diff: Describe the files if needed.
EOF

    cat "$1.prepare" >> "$1"

    cp "$1" "$1.prepare"
fi

exit 0
