]> git.droids-corp.org - git-central.git/commitdiff
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 6e1264b0aa7841662539a3efe31f91fe1ede6f25..020cd90bf17f6d38b46d2f7ad571957db03ecd43 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 45f178248ad2409056355f163ce9917eb1c71d24..8a5711d6bc214a20820ccfda60b34f33d0b87255 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