3 # When updating a branch, ensure it has the latest changes
4 # from other branches, e.g. stable.
6 # While this forces merging sooner than devs may like, it
7 # assures deployment and qa staff that the latest revisions
8 # they are qa'ing will always have the last stable release
12 . $(dirname $0)/functions
19 # Look up the config variable and exit if not set
20 follows=$(git config hooks.update-ensure-follows.branches)
21 if [[ $? -ne 0 ]] ; then
25 # Branch deletions are okay
26 if expr "$newrev" : '0*$' >/dev/null ; then
30 # We only care about branches moving--ignore tags.
33 short_refname=${refname##refs/heads/}
40 excused=" $(git config hooks.update-ensure-follows.excused) "
41 if [[ $excused =~ " $short_refname " ]] ; then
47 for ((i = 0 ; i < count ; i++)) do
48 follow="${follows[$i]}"
49 git rev-parse --verify --quiet "$follow"
50 if [ $? -eq 0 ] ; then
51 missing_commits=$(git log ^$newrev $follow --pretty=oneline | wc -l)
52 if [ $missing_commits -ne 0 ] ; then
53 display_error_message "You need to merge $follow into $short_refname"