summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-05-24 21:29:41 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-05-28 08:00:13 -0700
commit1a810864e87b78c08295acca124eb66b8cf2a973 (patch)
tree8d43a148b421d64f69e647f5ff3489ca41d3e958 /contrib
parentremote-hg: add test to push new bookmark (diff)
downloadtgif-1a810864e87b78c08295acca124eb66b8cf2a973.tar.xz
remote-hg: add test for diverged push
Neither mercurial nor git allows pushing to a remote when it's a non-fast-forward push. We should be able to detect these errors and report them properly, as opposed to throwing an exception stack-trace. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/test-hg.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 8d70f4aefc..f4dac526ee 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