Re: [PATCH] Documentation/githooks: Explain pre-rebase parameters
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 19, 2013, 17:05 UTC
- Message-ID
- <7vliak6xop.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <878v6ksars.fsf@pctrast.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
>> "$GIT_DIR/hooks/pre-rebase" ${1+"$@"}
> ...
> IIRC this particular usage was designed to suppress warnings about unset
> variables.This is an old-timer's habit to work around buggy implementations of Bourne shells where they failed to expand "$@" to nothing when there is no parameters, feeding a single empty argument to the command. By explicitly writing ${1+...}, the construct makes sure that when we have no parameter (i.e. $1 is unset) we do not even look at "$@".
It is equivalent to "$@" in correctly implemented shells.