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