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