Bogdan Stolojan / cloud-pb
Committer:
bogthe
Date:
Mon Mar 26 14:52:48 2018 +0000
Revision:
0:c77fc6326067
Initial commit

Who changed what in which revision?

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