Mercurial > hg > waet-hammond-1
annotate new/.git/hooks/commit-msg.sample @ 22:1f375b7d75fd tip
updated warning for breaks during test
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 13 May 2016 19:01:08 +0100 |
parents | 853caf8cd74b |
children |
rev | line source |
---|---|
giuliomoro@15 | 1 #!/bin/sh |
giuliomoro@15 | 2 # |
giuliomoro@15 | 3 # An example hook script to check the commit log message. |
giuliomoro@15 | 4 # Called by "git commit" with one argument, the name of the file |
giuliomoro@15 | 5 # that has the commit message. The hook should exit with non-zero |
giuliomoro@15 | 6 # status after issuing an appropriate message if it wants to stop the |
giuliomoro@15 | 7 # commit. The hook is allowed to edit the commit message file. |
giuliomoro@15 | 8 # |
giuliomoro@15 | 9 # To enable this hook, rename this file to "commit-msg". |
giuliomoro@15 | 10 |
giuliomoro@15 | 11 # Uncomment the below to add a Signed-off-by line to the message. |
giuliomoro@15 | 12 # Doing this in a hook is a bad idea in general, but the prepare-commit-msg |
giuliomoro@15 | 13 # hook is more suited to it. |
giuliomoro@15 | 14 # |
giuliomoro@15 | 15 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
giuliomoro@15 | 16 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
giuliomoro@15 | 17 |
giuliomoro@15 | 18 # This example catches duplicate Signed-off-by lines. |
giuliomoro@15 | 19 |
giuliomoro@15 | 20 test "" = "$(grep '^Signed-off-by: ' "$1" | |
giuliomoro@15 | 21 sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { |
giuliomoro@15 | 22 echo >&2 Duplicate Signed-off-by lines. |
giuliomoro@15 | 23 exit 1 |
giuliomoro@15 | 24 } |