From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] submodule: handle trailing slash, warn about non-submodules
Date: Sat, 07 Feb 2009 00:36:51 -0800 [thread overview]
Message-ID: <7vfxiqy76k.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <b14e34d2529721c24437ec9da3f8f15c916d4051.1233892769u.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Fri, 6 Feb 2009 05:00:22 +0100 (CET)")
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> Earlier, when you called
>
> git submodule path/to/submodule/
>
> (which happens easily if you are a heavy user of tab-completion), Git
> would silently ignore the given path, as "git ls-files path/to/submodule/"
> does not return anything due to the trailing slash.
I see a sign of concentrating too much on the topic you were interested in
to blind yourself here in this patch.
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 2f47e06..b878909 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -59,7 +59,19 @@ resolve_relative_url ()
> #
> module_list()
> {
> - git ls-files --stage -- "$@" | grep '^160000 '
> + while test $# -gt 0
> + do
> + line=$(git ls-files --stage "${1%/}" | grep '^160000 ')
> + case "$line" in
> + '')
> + echo "Warning: ignoring non-submodule '$1'" >&2
> + ;;
> + *)
> + echo "$line"
> + ;;
> + esac
> + shift
> + done
Almost everybody seems to call module_list with the arguments it received
from the caller, but that "$@" could be none. Worse, cmd_foreach always
calls module_list with no argument. Earlier you got all submodules, now
you get none.
So you would need:
case $# in
0)
git ls-files --stage -- | grep '^160000 '
;;
*)
your while loop
;;
esac
or something, I think.
next prev parent reply other threads:[~2009-02-07 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1233892769u.git.johannes.schindelin@gmx.de>
2009-02-06 4:00 ` [PATCH] submodule: handle trailing slash, warn about non-submodules Johannes Schindelin
2009-02-06 5:29 ` Junio C Hamano
2009-02-06 11:41 ` Johannes Schindelin
2009-02-07 8:36 ` Junio C Hamano [this message]
2009-02-07 13:42 ` [PATCH 0/2] submodule path handling fixes Johannes Schindelin
2009-02-07 21:45 ` Junio C Hamano
2009-02-07 13:43 ` [PATCH 1/2] Let ls-files strip trailing slashes in submodules' paths Johannes Schindelin
2009-02-07 13:43 ` [PATCH 2/2] submodule: warn about non-submodules Johannes Schindelin
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=7vfxiqy76k.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/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).