summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1945237)
raw | patch | inline | side by side (parent: 1945237)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Fri, 8 Jan 2010 02:12:41 +0000 (10:12 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 Jan 2010 07:34:10 +0000 (23:34 -0800) |
Some refs can only be matched to a remote ref with an explicit refspec.
When such a ref is a non-fast-forward of its remote ref, test that
pushing them (with the explicit refspec specified) fails with a non-
fast-foward-type error (viz. printing of ref status and help message).
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When such a ref is a non-fast-forward of its remote ref, test that
pushing them (with the explicit refspec specified) fails with a non-
fast-foward-type error (viz. printing of ref status and help message).
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5541-http-push.sh | patch | blob | history |
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index f49c7c4178c9c6ab098f73cbed799868ee40fa31..cc740fe124a4d656b588dc0a881396b068b961f8 100755 (executable)
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
section of '"'git push --help'"' for details." output
'
+test_expect_failure 'push fails for non-fast-forward refs unmatched by remote helper' '
+ # create a dissimilarly-named remote ref so that git is unable to match the
+ # two refs (viz. local, remote) unless an explicit refspec is provided.
+ git push origin master:retsam
+
+ echo "change changed" > path2 &&
+ git commit -a -m path2 --amend &&
+
+ # push master too; this ensures there is at least one '"'push'"' command to
+ # the remote helper and triggers interaction with the helper.
+ !(git push -v origin +master master:retsam >output 2>&1) &&
+
+ grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
+ grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
+
+ grep \
+"To prevent you from losing history, non-fast-forward updates were rejected
+Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
+section of '"'git push --help'"' for details." output
+'
+
stop_httpd
test_done