git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Re* git submodule output on invalid command

From
David Aguilar <davvid@gmail.com>
Date
Sep 6, 2008, 04:22 UTC
Message-ID
<20080906042217.GB18930@gmail.com>
In-Reply-To
<7vy726v30m.fsf@gitster.siamese.dyndns.org>
On  0, Junio C Hamano <gitster@pobox.com> wrote:
Show 29 quoted lines
> Pieter de Bie <pdebie@ai.rug.nl> writes:
> 
> > ..., something like 'git
> > submodule satsus' is valid and should return nothing, because there are
> > no submodules in the 'satsus' path. However, I still feel this should
> > produce a warning.
> >
> > I'm sure there is a nicer way to alert the user than my patch below, which
> > warns if the user did not supply any valid paths. Anyone else got a more
> > satisfying approach?
> 
> "ls-files --error-unmatch" would warn you of mistyped nonexistent paths,
> but "git submodule Makefile" would still catch the Makefile from the
> toplevel superproject happily and will not complain without checking after
> filtering by submodules.
> 
> > diff --git a/git-submodule.sh b/git-submodule.sh
> > index 1c39b59..3aae746 100755
> > --- a/git-submodule.sh
> > +++ b/git-submodule.sh
> > @@ -59,7 +59,12 @@ resolve_relative_url ()
> >  #
> >  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.

Thanks,
-- 
	David
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “git submodule output on invalid command”
  1. Pieter de BieSep 5, 2008
  2. Re* git submodule output on invalid commandJunio C Hamano, Sep 5, 2008
  3. David AguilarSep 6, 2008
  4. Junio C HamanoSep 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.