newrev="$3"
 
 # Look up the config variable and exit if not set
-follows=$(git config hooks.ensure-follows)
+follows=$(git config hooks.update-ensure-follows.branches)
 if [[ $? -ne 0 ]] ; then
        exit 0
 fi
                ;;
 esac
 
+excused=" $(git config hooks.update-ensure-follows.excused) "
+if [[ $excused =~ " $short_refname " ]] ; then
+       exit 0
+fi
+
 follows=($follows)
 count=${#follows[@]}
 for ((i = 0 ; i < count ; i++)) do
        follow="${follows[$i]}"
-       missing_commits=$(git log ^$newrev $follow --pretty=oneline | wc -l)
-       if [ $missing_commits -ne 0 ] ; then
-               echo "----------------------------------------------------"
-               echo
-               echo "You need to merge $follow into $short_refname"
-               echo
-               echo "----------------------------------------------------"
-               exit 1
+       git rev-parse "$follow"
+       if [ $? -eq 0 ] ; then
+               missing_commits=$(git log ^$newrev $follow --pretty=oneline | wc -l)
+               if [ $missing_commits -ne 0 ] ; then
+                       echo "----------------------------------------------------"
+                       echo
+                       echo "You need to merge $follow into $short_refname"
+                       echo
+                       echo "----------------------------------------------------"
+                       exit 1
+               fi
        fi
 done
 
 
 
 test_expect_success 'branch with unmoved stable is okay' '
        cd server &&
-       git config hooks.ensure-follows stable &&
+       git config hooks.update-ensure-follows.branches stable &&
        cd .. &&
 
        git checkout -b topic1 &&
 
 test_expect_success 'branch with moved stable as second branch requires merge' '
        cd server &&
-       git config hooks.ensure-follows "foo stable" &&
+       git config hooks.update-ensure-follows.branches "foo stable" &&
        cd .. &&
 
        git checkout stable &&
        git checkout stable &&
        echo "$test_name" >a &&
        git commit -a -m "Change on stable" &&
-       git push origin :stable
+
+       git push origin :topic1
+'
+
+test_expect_success 'excused branch with moved stable is okay' '
+       git checkout -b topic2 stable &&
+       echo "$test_name" >a.topic2 &&
+       git add a.topic2 &&
+       git commit -m "Change on topic2" &&
+       git push origin topic2 &&
+
+       git checkout stable &&
+       echo "$test_name" >a &&
+       git commit -a -m "Change on stable" &&
+       git push origin stable &&
+
+       git checkout topic2 &&
+       echo "$test_name foo" >a.topic2 &&
+       git commit -a -m "Change on topic2 again" &&
+       ! git push origin topic2 &&
+
+       cd server &&
+       git config hooks.update-ensure-follows.excused topic2 &&
+       cd .. &&
+
+       git push origin topic2
 '
 
 test_done