]> git.ipfire.org Git - thirdparty/git.git/blame - templates/hooks--update
GIT 0.99.9e
[thirdparty/git.git] / templates / hooks--update
CommitLineData
8d5afef0
JH
1#!/bin/sh
2#
3# An example hook script to mail out commit update information.
c65a9470 4# Called by git-receive-pack with arguments: refname sha1-old sha1-new
8d5afef0
JH
5#
6# To enable this hook:
7# (1) change the recipient e-mail address
8# (2) make this file executable by "chmod +x update".
9#
10
11recipient="commit-list@mydomain.xz"
12
13if expr "$2" : '0*$' >/dev/null
14then
15 echo "Created a new ref, with the following commits:"
c65a9470 16 git-rev-list --pretty "$3"
8d5afef0 17else
c65a9470 18 $base=$(git-merge-base "$2" "$3")
86b13da4
JH
19 case "$base" in
20 "$2")
c65a9470 21 echo "New commits:"
86b13da4
JH
22 ;;
23 *)
c65a9470 24 echo "Rebased ref, commits from common ancestor:"
86b13da4
JH
25 ;;
26 esac
c65a9470
JW
27fi
28git-rev-list --pretty "$3" "^$base"
8d5afef0
JH
29fi |
30mail -s "Changes to ref $1" "$recipient"
31exit 0