git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: Pieter de Bie <pdebie@ai.rug.nl>, Git Mailinglist <git@vger.kernel.org>
Subject: Re: Re* git submodule output on invalid command
Date: Fri, 05 Sep 2008 22:03:02 -0700	[thread overview]
Message-ID: <7vd4jhuard.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080906042217.GB18930@gmail.com> (David Aguilar's message of "Fri, 5 Sep 2008 21:22:18 -0700")

David Aguilar <davvid@gmail.com> writes:

> 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.

      reply	other threads:[~2008-09-06  5:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-05 16:16 git submodule output on invalid command Pieter de Bie
2008-09-05 18:52 ` Re* " Junio C Hamano
2008-09-06  4:22   ` David Aguilar
2008-09-06  5:03     ` Junio C Hamano [this message]

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=7vd4jhuard.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pdebie@ai.rug.nl \
    /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).