Re: Re* git submodule output on invalid command
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2008, 05:03 UTC
- Message-ID
- <7vd4jhuard.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080906042217.GB18930@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 15 quoted lines
> On 0, Junio C Hamano <gitster@pobox.com> wrote:
>> Pieter de Bie <pdebie@ai.rug.nl> writes:
>> ...
>> > module_list()
>> > {
>> > - git ls-files --stage -- "$@" | grep '^160000 '
>> > + git ls-files --stage -- "$@" | grep '^160000 ' ||
>> > + if test -z "$@"; then
>>
>> Shell nit; this must be "$*" not "$@", right?
>
> I added the module_list() function when moving the duplicated
> code into a separate function. The code was lifted verbatim.
> I can submit a patch cleaning that up if it should indeed use
> "$*". Just let me know.Nothing you did is involved in this nit; I was talking about "test -z" argument.
cmd "$@"
gives N separate argument to the "cmd", as if each of them is surrounded by a dq pair, i.e.
cmd "$1" "$2" "$3"...
while
cmd "$*"
gives a single argument to the "cmd", all separated with the first character of $IFS (typically a SP), i.e.
cmd "$1 $2 $3..."
which is what the "test -z" above would want to test (testing $# is Ok for the purpose of this test as well).
The "$@" you moved is the argument given to ls-files; that one should be "$@" and replacing it to "$*" would be wrong.