Skip to content

Instantly share code, notes, and snippets.

@prati0100
Created September 4, 2019 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prati0100/2d0bf7bd7b2f15c278838f9ab7fc23dc to your computer and use it in GitHub Desktop.
Save prati0100/2d0bf7bd7b2f15c278838f9ab7fc23dc to your computer and use it in GitHub Desktop.
#!/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