More email tests.
[git-central.git] / server / pre-receive-stable
1 #!/bin/sh
2
3 while read oldrev newrev refname ; do
4         if expr "$oldrev" : '0*$' >/dev/null ; then
5                 exit 0
6         fi
7
8         if [ "$refname" != "refs/heads/stable" ] ; then
9                 exit 0
10         fi
11
12         # read backwards:
13         # - all commits from old..new
14         # - unless they were already pointed to by a branch
15         # - unless that branch is us
16         # = all new commits on stable
17         count=$(git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --stdin $oldrev..$newrev | wc -l)
18         if [ "$count" -ne "0" ] ; then
19                 newname=$(git rev-parse "$newrev")
20                 echo "----------------------------------------------------"
21                 echo
22                 echo "Moving stable to $newname includes a new commit"
23                 echo
24                 echo "----------------------------------------------------"
25                 exit 1
26         fi
27 done
28
29