3 # An example hook script that is called after a successful
6 # To enable this hook, make this file executable.
11 # FROM - The From address for the commit messages
14 # Where to send the commit messages
19 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
:/usr
/local
/git
/bin
25 # Default shell globbing messes things up downstream
29 $verbose && echo >&2 "-Info- $1"
33 $verbose && echo >&2 "-Yes- $1"
39 $verbose && echo >&2 "-Deny- $1"
46 REF1
=`echo $ARGS | awk '{print $1}'`
47 REF2
=`echo $ARGS | awk '{print $2}'`
48 REF3
=`echo $ARGS | awk '{print $3}'`
50 DEPOT
=`basename ${_PWD}`
52 # Check if commit/push is made to a branch we are interested in.
53 rc
=$
(cat info
/notify |
grep -v '^#' |
grep -v '^$' |
54 while read head_pattern
; do
55 matchlen
=$
(expr "$REF3" : "$head_pattern")
56 if [ "$matchlen" == "${#REF3}" ]; then
57 info
"Found matching pattern: '$head_pattern'"
65 # Its turns out we are interested in the commit/push
66 info
"Going to notify about commit/push ($REF3)"
68 # Build up the mail command
69 ABBREVHASH
=`git-log --pretty=format:%h HEAD -1`
70 SUBJECT
="commit to ${REF3} in ${DEPOT} - HEAD is now ${ABBREVHASH}"
72 if [ ! -z "${BCC}" ]; then
73 info
"Adding bcc entries"
74 # Add the bcc's to MAILCMD
78 # Complete the MAILCMD with a final recipient
80 git-log
--pretty=medium
-p ${REF1}..${REF2} | mailx -s "${SUBJECT}" -a "From: ${FROM}" ${BCC} ${TO}