Created
September 4, 2019 20:01
-
-
Save prati0100/2d0bf7bd7b2f15c278838f9ab7fc23dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED=$(tput setaf 1) | |
NORMAL=$(tput sgr0) | |
# FIXME: I am using porcelain commands to do plumbing work. Maybe fix it in the | |
# future. | |
AUTHOR=$(git --no-pager show -s --format='%aN <%aE>') | |
COMMIT_MSG=$(git --no-pager show -s --format='%B') | |
COMMIT_ID=$(git --no-pager show -s --format='%h') | |
# See if the author signed off | |
echo "$COMMIT_MSG" | grep "^Signed-off-by: $AUTHOR" > /dev/null | |
if test $? -eq 0; then | |
exit 0 | |
else | |
printf "%sAuthor of commit $COMMIT_ID did not sign off%s\n" $RED $NORMAL | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment