annotate BSseeker2/.git/hooks/commit-msg.sample @ 1:8b26adf64adc draft default tip

V2.0.5
author weilong-guo
date Tue, 05 Nov 2013 01:55:39 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
weilong-guo
parents:
diff changeset
1 #!/bin/sh
weilong-guo
parents:
diff changeset
2 #
weilong-guo
parents:
diff changeset
3 # An example hook script to check the commit log message.
weilong-guo
parents:
diff changeset
4 # Called by "git commit" with one argument, the name of the file
weilong-guo
parents:
diff changeset
5 # that has the commit message. The hook should exit with non-zero
weilong-guo
parents:
diff changeset
6 # status after issuing an appropriate message if it wants to stop the
weilong-guo
parents:
diff changeset
7 # commit. The hook is allowed to edit the commit message file.
weilong-guo
parents:
diff changeset
8 #
weilong-guo
parents:
diff changeset
9 # To enable this hook, rename this file to "commit-msg".
weilong-guo
parents:
diff changeset
10
weilong-guo
parents:
diff changeset
11 # Uncomment the below to add a Signed-off-by line to the message.
weilong-guo
parents:
diff changeset
12 # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
weilong-guo
parents:
diff changeset
13 # hook is more suited to it.
weilong-guo
parents:
diff changeset
14 #
weilong-guo
parents:
diff changeset
15 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
weilong-guo
parents:
diff changeset
16 # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
weilong-guo
parents:
diff changeset
17
weilong-guo
parents:
diff changeset
18 # This example catches duplicate Signed-off-by lines.
weilong-guo
parents:
diff changeset
19
weilong-guo
parents:
diff changeset
20 test "" = "$(grep '^Signed-off-by: ' "$1" |
weilong-guo
parents:
diff changeset
21 sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
weilong-guo
parents:
diff changeset
22 echo >&2 Duplicate Signed-off-by lines.
weilong-guo
parents:
diff changeset
23 exit 1
weilong-guo
parents:
diff changeset
24 }