3 # This is a generic update hook script for GIT repositories.
4 # Written by Martin Mares <mj@ucw.cz> based on the template from GIT distribution.
6 # Called by git-receive-pack with arguments: refname sha1-old sha1-new
8 # Expects the following environment variables to be set:
10 # recipient where to send the mail reports to
11 # sub_prefix prefix which should be prepended to mail subject
14 branch=${1#refs/heads/}
15 if [ "$branch" == "$1" ] ; then
16 # Not something we care about
19 if [ $branch == origin ] ; then
20 # We are not following the origin
24 out=`mktemp -t gitlog.XXXXXXX`
25 if [ $branch == master ] ; then
28 subj="[$sub_prefix:$branch]"
32 if expr "$2" : '0*$' >/dev/null ; then
33 echo "Created a new branch $branch, with the following commits:"
35 git-rev-list --pretty --max-count=20 "$3"
36 echo "(and possibly more)"
38 base=$(git-merge-base "$2" "$3")
41 echo "New commits to branch $branch:"
44 echo "Rebased branch $branch, commits from common ancestor:"
48 git-rev-list --pretty "$3" "^$base"
49 git-diff -C "$base" "$3"
50 t=`mktemp -t gitlog.XXXXXXX`
51 git-diff --name-only -r "$base" "$3" >$t
53 if [ ${#subj} -lt 80 ] ; then
61 mutt -F/dev/null -x -e 'set charset="utf-8"; set send_charset="us-ascii:iso-8859-2:utf-8"' -s "$subj" "$recipient" <$out