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
17 # Look up the config variable and exit if not set
18 follows=$(git config hooks.update-ensure-follows.branches)
19 if [[ $? -ne 0 ]] ; then
23 # Branch deletions are okay
24 if expr "$newrev" : '0*$' >/dev/null ; then
28 # We only care about branches moving--ignore tags.
31 short_refname=${refname##refs/heads/}
38 excused=" $(git config hooks.update-ensure-follows.excused) "
39 if [[ $excused =~ " $short_refname " ]] ; then
45 for ((i = 0 ; i < count ; i++)) do
46 follow="${follows[$i]}"
47 git rev-parse "$follow"
48 if [ $? -eq 0 ] ; then
49 missing_commits=$(git log ^$newrev $follow --pretty=oneline | wc -l)
50 if [ $missing_commits -ne 0 ] ; then
51 echo "----------------------------------------------------"
53 echo "You need to merge $follow into $short_refname"
55 echo "----------------------------------------------------"