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