Chris@14: #!/bin/sh Chris@14: # Chris@14: # An example hook script to check the commit log message. Chris@14: # Called by "git commit" with one argument, the name of the file Chris@14: # that has the commit message. The hook should exit with non-zero Chris@14: # status after issuing an appropriate message if it wants to stop the Chris@14: # commit. The hook is allowed to edit the commit message file. Chris@14: # Chris@14: # To enable this hook, rename this file to "commit-msg". Chris@14: Chris@14: # Uncomment the below to add a Signed-off-by line to the message. Chris@14: # Doing this in a hook is a bad idea in general, but the prepare-commit-msg Chris@14: # hook is more suited to it. Chris@14: # Chris@14: # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') Chris@14: # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" Chris@14: Chris@14: # This example catches duplicate Signed-off-by lines. Chris@14: Chris@14: test "" = "$(grep '^Signed-off-by: ' "$1" | Chris@14: sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { Chris@14: echo >&2 Duplicate Signed-off-by lines. Chris@14: exit 1 Chris@14: }