Add git hook script to autofill hostname

Hook must be enabled in each repo manually

Tested-on: arcturus <06 Jan 2014>
This commit is contained in:
Tom Swartz
2014-01-06 14:15:29 -05:00
parent 74960e95b5
commit 5c0efe47d7
2 changed files with 17 additions and 2 deletions

17
prepare-commit-msg Executable file
View File

@@ -0,0 +1,17 @@
#!/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"