|
|
@ -76,3 +76,17 @@ then
|
|
|
|
printError "https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md"
|
|
|
|
printError "https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Add Sign-off-by line to the end of the commit message
|
|
|
|
|
|
|
|
# Get local git config
|
|
|
|
|
|
|
|
NAME=$(git config user.name)
|
|
|
|
|
|
|
|
EMAIL=$(git config user.email)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check if the commit message contains a sign-off line
|
|
|
|
|
|
|
|
grep -qs "^Signed-off-by: " "$1"
|
|
|
|
|
|
|
|
SIGNED_OFF_BY_EXISTS=$?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add "Signed-off-by" line if it doesn't exist
|
|
|
|
|
|
|
|
if [ $SIGNED_OFF_BY_EXISTS -ne 0 ]; then
|
|
|
|
|
|
|
|
echo -e "\nSigned-off-by: $NAME <$EMAIL>" >> "$1"
|
|
|
|
|
|
|
|
fi
|