annotate training-sessions/dave-ronan/.git/hooks/commit-msg.sample @ 0:246d5546657c

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