Debian Codegraph @

packaging/utils/git-private-update-hook

raw
1 #!/bin/sh
2 #
3 # An example hook script to mail out commit update information.
4 # Called by git-receive-pack with arguments: refname sha1-old sha1-new
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
11 exec 1>&2
12
13 recipient="[email protected]"
14
15 if expr "$2" : '0*$' >/dev/null
16 then
17 echo "Created a new ref, with the following commits:"
18 git-rev-list --pretty "$3"
19 else
20 base=$(git-merge-base "$2" "$3")
21 case "$base" in
22 "$2")
23 echo "New commits:"
24 ;;
25 *)
26 echo "Rebased ref, commits from common ancestor:"
27 ;;
28 esac
29 fi
30
31 git-rev-list --pretty "$3" "^$base" | mail -s "Changes to ref $1" "$recipient"
32 exit 0