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