Disallow creating branches that are directly (no-commit) on stable.
authorStephen Haberman <stephen@exigencecorp.com>
Wed, 27 Aug 2008 17:13:01 +0000 (12:13 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Wed, 27 Aug 2008 17:13:01 +0000 (12:13 -0500)
server/update-stable
tests/t2102-server-update-stable-candidate.sh

index 6e1264b..020cd90 100644 (file)
@@ -60,6 +60,22 @@ case "$refname" in
                ;;
 esac
 
+if [ "$change_type" == "delete" ] ; then
+       exit 0
+fi
+
+if [ "$change_type" == "create" -a "$short_refname" != "stable" ] ; then
+       not_on_stable=$(git rev-list stable..$newrev)
+       if [ "$not_on_stable" == "" ] ; then
+               echo "----------------------------------------------------"
+               echo
+               echo "Creating a branch must include new commits"
+               echo
+               echo "----------------------------------------------------"
+               exit 1
+       fi
+fi
+
 # create/delete is okay
 if [ "$change_type" != "update" ] ; then
        exit 0
index 45f1782..8a5711d 100644 (file)
@@ -85,5 +85,11 @@ test_expect_success 'topic1 cannot be changed' '
        cat push.err | grep "topic1 has been merged into stable"
 '
 
+test_expect_success 'topic3 cannot initially be created on stable' '
+       git checkout -b topic3 stable &&
+       ! git push origin topic3 2>push.err &&
+       cat push.err | grep "Creating a branch must include new commits"
+'
+
 test_done