git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: "W. Trevor King" <wking@tremily.us>
Cc: Git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Documentation/githooks: Explain pre-rebase parameters
Date: Tue, 19 Feb 2013 14:17:43 +0100	[thread overview]
Message-ID: <878v6ksars.fsf@pctrast.inf.ethz.ch> (raw)
In-Reply-To: <c19c03f51d71a58fa3795f665fe4a4c0461fa58f.1361271116.git.wking@tremily.us> (W. Trevor King's message of "Tue, 19 Feb 2013 06:03:24 -0500")

"W. Trevor King" <wking@tremily.us> writes:

> I'm not 100% convinced about this, because the git-rebase.sh uses:
>
>   "$GIT_DIR/hooks/pre-rebase" ${1+"$@"}
>
> I haven't been able to find documentation for the ${1+"$@"} syntax.
> Is it in POSIX?  It's not in the Bash manual:
[...]
> In my local tests, it seems equivalent to "$@".

It's definitely in the bash manual and POSIX[1]: it's a special case of
the ${parameter+word} expansion.

   ${parameter:+word}
      Use Alternate Value.  If parameter is null or unset, nothing is
      substituted, otherwise the expansion of word is substituted.

plus

   ... bash tests for a parameter that is unset or null.  Omitting the
   colon results in a test only for a parameter that is unset.

IIRC this particular usage was designed to suppress warnings about unset
variables.


Footnotes: 
[1]  http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2013-02-19 13:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 11:03 [PATCH] Documentation/githooks: Explain pre-rebase parameters W. Trevor King
2013-02-19 13:17 ` Thomas Rast [this message]
2013-02-19 13:23   ` W. Trevor King
2013-02-19 17:05   ` Junio C Hamano
2013-02-19 19:08 ` Junio C Hamano
2013-02-20 16:36   ` W. Trevor King
2013-02-20 17:23     ` Junio C Hamano
2013-02-23 15:27     ` [PATCH v2] " W. Trevor King
2013-02-23 21:21       ` Junio C Hamano
2013-02-23 21:35         ` W. Trevor King
2013-02-24  8:13           ` Junio C Hamano

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=878v6ksars.fsf@pctrast.inf.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=wking@tremily.us \
    /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).