Add sendemail-validate hook for checking signoffby lines
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
366ca62eb9
commit
4bc25c3b80
1 changed files with 28 additions and 0 deletions
28
scripts/hooks/sendemail-validate.signoffby-missing-warn.sh
Normal file
28
scripts/hooks/sendemail-validate.signoffby-missing-warn.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# The following snippet can be used to _WARN_ if a Signed-off-by line is missing
|
||||
# in the commit message of the patch
|
||||
#
|
||||
# Use
|
||||
#
|
||||
# git config sendemail.validate true
|
||||
#
|
||||
# and link this script to your git hooks folder to enable.
|
||||
#
|
||||
|
||||
GREEN='\e[0;32m' # Green
|
||||
RED='\e[0;31m' # Red
|
||||
NORMAL='\e[0m' # Text Reset
|
||||
|
||||
GREPLINE="^Signed-off-by: $(git config user.name) <$(git config user.email)>"
|
||||
|
||||
if [ "$(grep -c "$GREPLINE" "$1")" -lt 1 ]; then
|
||||
echo -e >&2 "${RED}Missing Signed-off-by line.${NORMAL}\n"
|
||||
|
||||
# To not only warn, but abort the patch sending, uncomment the next line
|
||||
# exit 1
|
||||
else
|
||||
echo -e >&2 "${GREEN}Signed-off-by line found.${NORMAL}\n"
|
||||
fi
|
||||
|
Loading…
Reference in a new issue