2017-08-27 20:32:18 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# An hook script to check the commit log message taken by
|
|
|
|
# applypatch from an e-mail message for proper "Signed-off-by" line(s).
|
|
|
|
#
|
|
|
|
# To enable this hook, copy this file to ".git/hooks/applypatch-msg" and make it
|
|
|
|
# executable.
|
|
|
|
|
|
|
|
#
|
|
|
|
# This hook is used when applying patches which are send via mail, to verify the
|
|
|
|
# Signed-off-by line is in the commit message.
|
|
|
|
#
|
|
|
|
|
|
|
|
. git-sh-setup
|
|
|
|
|
2019-07-26 22:39:07 +00:00
|
|
|
GREEN='\e[0;32m' # Green
|
2017-08-27 20:32:18 +00:00
|
|
|
RED='\e[0;31m' # Red
|
|
|
|
YELLOW='\e[0;33m' # Yellow
|
|
|
|
NORMAL='\e[0m' # Text Reset
|
|
|
|
|
|
|
|
warn() {
|
|
|
|
echo -e >&2 "${YELLOW}$*${DEFAULT}"
|
|
|
|
}
|
|
|
|
|
|
|
|
abort() {
|
|
|
|
echo -e >&2 "${RED}$*${DEFAULT}"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
headline=$(head -n 1 $1 | wc -c)
|
|
|
|
[[ $headline -gt 50 ]] && warn "Headline of patch longer than 50 chars"
|
|
|
|
|
2019-07-26 22:39:07 +00:00
|
|
|
grep -q "^Signed-off-by" $1 || abort "No Signed-off-by line"
|
2017-08-27 20:32:18 +00:00
|
|
|
|