#!/bin/sh while read oldrev newrev refname ; do if expr "$oldrev" : '0*$' >/dev/null ; then exit 0 fi if [ "$refname" != "refs/heads/stable" ] ; then exit 0 fi # read backwards: # - all commits from old..new # - unless they were already pointed to by a branch # - unless that branch is us # = all new commits on stable count=$(git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --stdin $oldrev..$newrev | wc -l) if [ "$count" -ne "0" ] ; then newname=$(git rev-parse "$newrev") echo "----------------------------------------------------" echo echo "Moving stable to $newname includes a new commit" echo echo "----------------------------------------------------" exit 1 fi done