annotate clausiepy/.git/hooks/commit-msg.sample @ 1:2082aeb1f1be tip

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