Re: [PATCH] t5528: do not fail with FreeBSD shell

From
Jeff King <hidden>
Date
2016-06-15 23:04:05
Reply to
Kyle J. McKay, 2016-06-15
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.
quoted hunk ↗ jump to hunk
---
 t/t5528-push-default.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Patch itself looks obviously correct.

-Peff
Thread (4 messages) 4 messages, 2 authors, last reply 2016-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help