Files
linux-configs/prepare-commit-msg
Tom Swartz 5d30163779 Correct prepare-commit-msg for Git Amends
Corrected the grep to properly identify the 'tested on' string, and
prevent it's inclusion if present.

The 'tested on' string should still be included if the amendment is made
on a later date.

Tested-on: arcturus <09 Jan 2014>
2014-01-09 13:35:09 -05:00

18 lines
613 B
Bash
Executable File

#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
DATE=$(date +"%d %b %Y")
HOSTNAME=$HOSTNAME
TestedMSG="Tested-on: $HOSTNAME <$DATE>"
grep -qs "$TestedMSG" "$1" || echo "$TestedMSG" >> "$1"