From: Felipe Contreras Date: Sat, 25 May 2013 02:29:41 GMT Subject: [PATCH v2 25/48] remote-hg: add test for diverged push Message-ID: <1369449004-17981-26-git-send-email-felipe.contreras@gmail.com> In-Reply-To: <1369449004-17981-1-git-send-email-felipe.contreras@gmail.com> Neither mercurial nor git allows pushing to a remote when it's a non-fast-forward push. We should be able to detect theses errors and report them properly. As opposed to throwing an exception stack-trace. Signed-off-by: Felipe Contreras --- contrib/remote-helpers/test-hg.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh index 8b5e191..252553e 100755 --- a/contrib/remote-helpers/test-hg.sh +++ b/contrib/remote-helpers/test-hg.sh @@ -318,4 +318,27 @@ test_expect_success 'remote new bookmark' ' check_bookmark hgrepo feature-b feature-b ' +test_expect_failure 'remote push diverged' ' + test_when_finished "rm -rf gitrepo*" && + + git clone "hg::hgrepo" gitrepo && + + ( + cd hgrepo && + hg checkout default && + echo bump > content && + hg commit -m bump + ) && + + ( + cd gitrepo && + echo diverge > content && + git commit -a -m diverged && + test_expect_code 1 git push 2> error && + grep "^ ! \[rejected\] *master -> master (non-fast-forward)$" error + ) && + + check_branch hgrepo default bump +' + test_done -- 1.8.3.rc3.312.g47657de