From: Stephen Haberman Date: Mon, 3 Nov 2008 21:23:35 +0000 (-0600) Subject: New branches should not get the update your local branch message. X-Git-Url: http://git.droids-corp.org/?p=git-central.git;a=commitdiff_plain;h=0661231128430062a02520b7f47a037f69be5b20 New branches should not get the update your local branch message. --- diff --git a/server/update-ensure-follows b/server/update-ensure-follows index a3c6b92..65fb021 100644 --- a/server/update-ensure-follows +++ b/server/update-ensure-follows @@ -53,7 +53,7 @@ for ((i = 0 ; i < count ; i++)) do # If for some reason people are stupid and push with a --force flag, # we should warn them to update first in case one of their teammates # already merged for them - if [ "$(git merge-base $oldrev $newrev)" != "$oldrev" ] ; then + if [ "0000000000000000000000000000000000000000" != "$oldrev" -a "$(git merge-base $oldrev $newrev)" != "$oldrev" ] ; then display_error_message "You need to update your local branch $short_refname" else display_error_message "You need to merge $follow into $short_refname" diff --git a/tests/t2700-server-ensure-follows.sh b/tests/t2700-server-ensure-follows.sh index 0f9b8f9..514ca73 100644 --- a/tests/t2700-server-ensure-follows.sh +++ b/tests/t2700-server-ensure-follows.sh @@ -135,5 +135,24 @@ test_expect_success 'excused branch with moved stable is okay' ' git push origin topic2 ' +test_expect_success 'new branch without stable gets nicer error' ' + git checkout -b topic3 stable && + echo "$test_name" >a.topic3 && + git add a.topic3 && + git commit -m "Change on topic3" && + + git checkout stable && + echo "$test_name" >a && + git commit -a -m "Change on stable" && + git push origin stable && + + git checkout topic3 && + ! git push origin topic3 2>push.err && + grep "You need to merge stable into topic3" push.err && + + git merge stable && + git push origin topic3 +' + test_done