Fork for workshops

Committer:
JimCarver
Date:
Fri Oct 12 21:22:49 2018 +0000
Revision:
0:6b753f761943
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 0:6b753f761943 1 #!/bin/sh
JimCarver 0:6b753f761943 2 #
JimCarver 0:6b753f761943 3 # An example hook script to check the commit log message.
JimCarver 0:6b753f761943 4 # Called by "git commit" with one argument, the name of the file
JimCarver 0:6b753f761943 5 # that has the commit message. The hook should exit with non-zero
JimCarver 0:6b753f761943 6 # status after issuing an appropriate message if it wants to stop the
JimCarver 0:6b753f761943 7 # commit. The hook is allowed to edit the commit message file.
JimCarver 0:6b753f761943 8 #
JimCarver 0:6b753f761943 9 # To enable this hook, rename this file to "commit-msg".
JimCarver 0:6b753f761943 10
JimCarver 0:6b753f761943 11 # Uncomment the below to add a Signed-off-by line to the message.
JimCarver 0:6b753f761943 12 # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
JimCarver 0:6b753f761943 13 # hook is more suited to it.
JimCarver 0:6b753f761943 14 #
JimCarver 0:6b753f761943 15 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
JimCarver 0:6b753f761943 16 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
JimCarver 0:6b753f761943 17
JimCarver 0:6b753f761943 18 # This example catches duplicate Signed-off-by lines.
JimCarver 0:6b753f761943 19
JimCarver 0:6b753f761943 20 test "" = "$(grep '^Signed-off-by: ' "$1" |
JimCarver 0:6b753f761943 21 sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
JimCarver 0:6b753f761943 22 echo >&2 Duplicate Signed-off-by lines.
JimCarver 0:6b753f761943 23 exit 1
JimCarver 0:6b753f761943 24 }