Re: [PATCH] Documentation/githooks: Explain pre-rebase parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"W. Trevor King" <wking@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]