# would insinuate qa didn't happen on the merged result).
#
# Also, we want to enforce that C does not actually introduce
-# any diffs to the files between B and C--otherwise this changes
-# would not have appeared in QA.
+# any diffs to the files between B and C--as they would be changes
+# that QA does not see.
#
. $(dirname $0)/functions
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
- display_error_message "Creating a branch must include new commits"
- exit 1
- fi
-fi
-
# create/delete is okay
if [ "$change_type" != "update" ] ; then
exit 0
fi
-# # The tip must always be new
-# already=$(git branch --contains "$newrev")
-# if [ "$already" != "" ] ; then
-# already=${already## }
-# echo "----------------------------------------------------"
-# echo
-# echo "$short_refname is already referred to by $already"
-# echo
-# echo "----------------------------------------------------"
-# exit 1
-#fi
-
if [ "$short_refname" == "stable" ] ; then
# Stable enforcement
fi
else
# Check if candidate/topic is already in stable
- git branch --contains "$oldrev" | grep stable >/dev/null
+ git branch --contains "$oldrev" | grep --quiet stable
if [ $? -eq 0 ] ; then
- display_error_message "$short_refname has been merged into stable"
- exit 1
+ # Okay, it's in stable...but was it previously just a 0-commit initial banch?
+ git rev-list --first-parent stable | grep --quiet "$oldrev"
+ if [ $? -ne 0 ] ; then
+ display_error_message "$short_refname has been merged into stable"
+ exit 1
+ fi
fi
# For now candidates can mix amongst each other so early exit
git reset --hard HEAD^
'
-test_expect_success 'topic3 cannot initially be created on stable' '
+test_expect_success 'topic3 can initially be created on stable and then moved' '
git checkout -b topic3 stable &&
- ! git push origin topic3 2>push.err &&
- cat push.err | grep "Creating a branch must include new commits" &&
+ git push origin topic3 &&
echo "$test_name" >a.topic3 &&
git add a.topic3 &&
git push origin topic3
'
-test_expect_failure 'topic4 cannot point to the same place as topic4' '
- git checkout -b topic4 topic3 &&
- echo "$test_name" >a.topic4 &&
- git add a.topic4 &&
- git commit -m "making topic4" &&
- git push origin topic4 &&
-
- ! git push origin topic4:topic3 2>push.err &&
- cat push.err | grep "topic3 is already referred to by topic4"
-'
-
test_done