Donald Meyers / Mbed OS evan
Committer:
djmeyers
Date:
Sat Mar 18 22:37:16 2017 +0000
Revision:
0:06ee5f8a484a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
djmeyers 0:06ee5f8a484a 1 #!/bin/sh
djmeyers 0:06ee5f8a484a 2 #
djmeyers 0:06ee5f8a484a 3 # An example hook script to check the commit log message.
djmeyers 0:06ee5f8a484a 4 # Called by "git commit" with one argument, the name of the file
djmeyers 0:06ee5f8a484a 5 # that has the commit message. The hook should exit with non-zero
djmeyers 0:06ee5f8a484a 6 # status after issuing an appropriate message if it wants to stop the
djmeyers 0:06ee5f8a484a 7 # commit. The hook is allowed to edit the commit message file.
djmeyers 0:06ee5f8a484a 8 #
djmeyers 0:06ee5f8a484a 9 # To enable this hook, rename this file to "commit-msg".
djmeyers 0:06ee5f8a484a 10
djmeyers 0:06ee5f8a484a 11 # Uncomment the below to add a Signed-off-by line to the message.
djmeyers 0:06ee5f8a484a 12 # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
djmeyers 0:06ee5f8a484a 13 # hook is more suited to it.
djmeyers 0:06ee5f8a484a 14 #
djmeyers 0:06ee5f8a484a 15 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
djmeyers 0:06ee5f8a484a 16 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
djmeyers 0:06ee5f8a484a 17
djmeyers 0:06ee5f8a484a 18 # This example catches duplicate Signed-off-by lines.
djmeyers 0:06ee5f8a484a 19
djmeyers 0:06ee5f8a484a 20 test "" = "$(grep '^Signed-off-by: ' "$1" |
djmeyers 0:06ee5f8a484a 21 sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
djmeyers 0:06ee5f8a484a 22 echo >&2 Duplicate Signed-off-by lines.
djmeyers 0:06ee5f8a484a 23 exit 1
djmeyers 0:06ee5f8a484a 24 }