Skip to content

Commit

Permalink
push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Mar 19, 2013
1 parent 848575d commit 5bd81c7
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions t/t5516-fetch-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ mk_test () {
(
for ref in "$@"
do
git push testrepo $the_first_commit:refs/$ref || {
echo "Oops, push refs/$ref failure"
exit 1
}
git push testrepo $the_first_commit:refs/$ref ||
exit
done &&
cd testrepo &&
for ref in "$@"
Expand Down Expand Up @@ -328,13 +326,8 @@ test_expect_success 'push with weak ambiguity (2)' '
test_expect_success 'push with ambiguity' '
mk_test heads/frotz tags/frotz &&
if git push testrepo master:frotz
then
echo "Oops, should have failed"
false
else
check_push_result $the_first_commit heads/frotz tags/frotz
fi
test_must_fail git push testrepo master:frotz &&
check_push_result $the_first_commit heads/frotz tags/frotz
'

Expand Down

0 comments on commit 5bd81c7

Please sign in to comment.