git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kyle J. McKay" <mackyle@gmail.com>
To: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Cc: Git mailing list <git@vger.kernel.org>
Subject: [PATCH] t5528: do not fail with FreeBSD shell
Date: Sun,  8 Mar 2015 08:37:50 -0700	[thread overview]
Message-ID: <e3bfc53363b14826d828e1adffbbeea@74d39fa044aa309eaea14b9f57fe79c> (raw)

The FreeBSD shell converts this expression:

  git ${1:+-c push.default="$1"} push

to this when "$1" is not empty:

  git "-c push.default=$1" push

which causes git to fail.  To avoid this we simply break up the
expansion into two parts so that the whitespace which creates
two arguments instead of one is outside the ${...} like so:

  git ${1:+-c} ${1:+push.default="$1"} push

This has the desired effect on all platforms allowing the test
to pass on FreeBSD.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
---
 t/t5528-push-default.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index cc745190..73f4bb63 100755
--- a/t/t5528-push-default.sh
+++ b/t/t5528-push-default.sh
@@ -26,7 +26,7 @@ check_pushed_commit () {
 # $2 = expected target branch for the push
 # $3 = [optional] repo to check for actual output (repo1 by default)
 test_push_success () {
-	git ${1:+-c push.default="$1"} push &&
+	git ${1:+-c} ${1:+push.default="$1"} push &&
 	check_pushed_commit HEAD "$2" "$3"
 }
 
@@ -34,7 +34,7 @@ test_push_success () {
 # check that push fails and does not modify any remote branch
 test_push_failure () {
 	git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect &&
-	test_must_fail git ${1:+-c push.default="$1"} push &&
+	test_must_fail git ${1:+-c} ${1:+push.default="$1"} push &&
 	git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
 	test_cmp expect actual
 }
---

             reply	other threads:[~2015-03-08 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 15:37 Kyle J. McKay [this message]
2015-03-08 17:56 ` [PATCH] t5528: do not fail with FreeBSD shell Jeff King
2015-03-09  5:19   ` Kyle J. McKay
2015-03-09  6:04     ` Jeff King

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=e3bfc53363b14826d828e1adffbbeea@74d39fa044aa309eaea14b9f57fe79c \
    --to=mackyle@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).