mirror of
https://github.com/zhigang1992/linux-configs.git
synced 2026-05-01 05:22:33 +08:00
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:
17
prepare-commit-msg
Executable file
17
prepare-commit-msg
Executable 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"
|
||||
Reference in New Issue
Block a user