push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
When it is unclear which command from a test has failed, usual practice these days is to debug by running the test again with "sh -x" instead of relying on debugging 'echo' statements. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Mar 18, 2013 at 16:14 UTC
5bd81c73156a623edc9dff42c26469732f49aa89
1 file changed
+4
-11
t/t5516-fetch-push.sh
+4
-11
@@ -22,10 +22,8 @@ mk_test () {
22
(
23
for ref in "$@"
24
do
25
- git push testrepo $the_first_commit:refs/$ref || {
26
- echo "Oops, push refs/$ref failure"
27
- exit 1
28
- }
25
+ git push testrepo $the_first_commit:refs/$ref ||
26
+ exit
27
done &&
28
cd testrepo &&
29
for ref in "$@"
@@ -328,13 +326,8 @@ test_expect_success 'push with weak ambiguity (2)' '
326
test_expect_success 'push with ambiguity' '
327
328
mk_test heads/frotz tags/frotz &&
331
- if git push testrepo master:frotz
332
- then
333
- echo "Oops, should have failed"
334
- false
335
- else
336
- check_push_result $the_first_commit heads/frotz tags/frotz
337
- fi
329
+ test_must_fail git push testrepo master:frotz &&
330
+ check_push_result $the_first_commit heads/frotz tags/frotz
331
332
'
333