Git development
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Rob Hoelz <rob@hoelz.ro>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	josh@joshtriplett.org
Subject: [PATCH 3/3] push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
Date: Mon, 18 Mar 2013 16:14:26 -0700	[thread overview]
Message-ID: <20130318231426.GG5062@elie.Belkin> (raw)
In-Reply-To: <20130318231043.GD5062@elie.Belkin>

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>
---
 t/t5516-fetch-push.sh | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 2f1255d4..0695d570 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -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 "$@"
@@ -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
 
 '
 
-- 
1.8.2.rc3

  parent reply	other threads:[~2013-03-18 23:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 21:02 [PATCH] push: Alias pushurl from push rewrites Rob Hoelz
2013-03-18 23:10 ` Jonathan Nieder
2013-03-18 23:12   ` [PATCH 1/3] push test: use test_config when appropriate Jonathan Nieder
2013-03-18 23:13   ` [PATCH 2/3] push test: simplify check of push result Jonathan Nieder
2013-03-18 23:14   ` Jonathan Nieder [this message]
2013-03-19  1:46   ` [PATCH] push: Alias pushurl from push rewrites Junio C Hamano
2013-03-19  1:55     ` Jonathan Nieder
2013-03-19 18:08       ` Junio C Hamano
2013-03-20 12:33         ` Rob Hoelz
2013-03-20 14:35           ` Junio C Hamano
2013-03-27 17:20             ` Rob Hoelz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130318231426.GG5062@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=josh@joshtriplett.org \
    --cc=rob@hoelz.ro \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox