init-db: check extra arguments and complain.
[git/gitweb.git] / templates / hooks--update
blob6db555f6580ca0831cf285a62ab7354211168203
1 #!/bin/sh
3 # An example hook script to mail out commit update information.
4 # Called by git-receive-pack with arguments: refname sha1-old sha1-new
6 # To enable this hook:
7 # (1) change the recipient e-mail address
8 # (2) make this file executable by "chmod +x update".
11 recipient="commit-list@example.com"
13 if expr "$2" : '0*$' >/dev/null
14 then
15 echo "Created a new ref, with the following commits:"
16 git-rev-list --pretty "$3"
17 else
18 base=$(git-merge-base "$2" "$3")
19 case "$base" in
20 "$2")
21 echo "New commits:"
24 echo "Rebased ref, commits from common ancestor:"
26 esac
27 git-rev-list --pretty "$3" "^$base"
28 fi |
29 mail -s "Changes to ref $1" "$recipient"
30 exit 0