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

On Sun, Mar 08, 2015 at 08:37:50AM -0700, Kyle J. McKay wrote:

> 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.

Hmph, just when I thought I knew about all of the weird shell quirks. :)

I am not convinced this isn't a violation of POSIX (which specifies that
field splitting is done on the results of parameter expansions outside
of double-quotes). But whether it is or not, we have to live with it.

For my own curiosity, what does:

  foo='with space'
  printf "%s\n" ${foo:+first "$foo"}

print? That is, are the double-quotes even doing anything on such a
shell? On bash and dash, it prints:

  first
  with space

which is what I would expect. So does "ash" (0.5.7, packaged for
Debian), which is what I _thought_ FreeBSD's shell was based on. But
clearly there is some divergence.

I guess they are getting eaten by your shell, otherwise we would pass
them along to git in the test script, which would complain.

> ---
>  t/t5528-push-default.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch itself looks obviously correct.

-Peff

  reply	other threads:[~2015-03-08 17:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 15:37 [PATCH] t5528: do not fail with FreeBSD shell Kyle J. McKay
2015-03-08 17:56 ` Jeff King [this message]
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=20150308175624.GA30399@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mackyle@gmail.com \
    /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).