annotate vendor/drupal/coder/.git/hooks/commit-msg.sample @ 19:fa3358dc1485 tip

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