Mercurial > lasercutter
annotate graster/hacklab-engraver/.git/hooks/commit-msg.sample @ 18:a769347618a1
saving
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 29 Aug 2010 23:44:59 -0400 |
parents | f952052e37b7 |
children |
rev | line source |
---|---|
rlm@11 | 1 #!/bin/sh |
rlm@11 | 2 # |
rlm@11 | 3 # An example hook script to check the commit log message. |
rlm@11 | 4 # Called by git-commit with one argument, the name of the file |
rlm@11 | 5 # that has the commit message. The hook should exit with non-zero |
rlm@11 | 6 # status after issuing an appropriate message if it wants to stop the |
rlm@11 | 7 # commit. The hook is allowed to edit the commit message file. |
rlm@11 | 8 # |
rlm@11 | 9 # To enable this hook, rename this file to "commit-msg". |
rlm@11 | 10 |
rlm@11 | 11 # Uncomment the below to add a Signed-off-by line to the message. |
rlm@11 | 12 # Doing this in a hook is a bad idea in general, but the prepare-commit-msg |
rlm@11 | 13 # hook is more suited to it. |
rlm@11 | 14 # |
rlm@11 | 15 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
rlm@11 | 16 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
rlm@11 | 17 |
rlm@11 | 18 # This example catches duplicate Signed-off-by lines. |
rlm@11 | 19 |
rlm@11 | 20 test "" = "$(grep '^Signed-off-by: ' "$1" | |
rlm@11 | 21 sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { |
rlm@11 | 22 echo >&2 Duplicate Signed-off-by lines. |
rlm@11 | 23 exit 1 |
rlm@11 | 24 } |