@matheusbsbs / matheus-bagliano / commits / 7b69079be9
Fork 0

t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs

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>

Tay Ray Chuan committed Jan 8, 2010 at 10:12 UTC 7b69079be964ca0a09a1a7895455ba3df379984e
1 file changed +21
t/t5541-http-push.sh
+21
@@ -111,5 +111,26 @@ Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
111 section of '"'git push --help'"' for details." output
112 '
113
114 +test_expect_failure 'push fails for non-fast-forward refs unmatched by remote helper' '
115 + # create a dissimilarly-named remote ref so that git is unable to match the
116 + # two refs (viz. local, remote) unless an explicit refspec is provided.
117 + git push origin master:retsam
118 +
119 + echo "change changed" > path2 &&
120 + git commit -a -m path2 --amend &&
121 +
122 + # push master too; this ensures there is at least one '"'push'"' command to
123 + # the remote helper and triggers interaction with the helper.
124 + !(git push -v origin +master master:retsam >output 2>&1) &&
125 +
126 + grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
127 + grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
128 +
129 + grep \
130 +"To prevent you from losing history, non-fast-forward updates were rejected
131 +Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
132 +section of '"'git push --help'"' for details." output
133 +'
134 +
135 stop_httpd
136 test_done