From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH] submodule: handle trailing slash, warn about non-submodules Date: Sat, 07 Feb 2009 00:36:51 -0800 Message-ID: <7vfxiqy76k.fsf@gitster.siamese.dyndns.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org To: Johannes Schindelin X-From: git-owner@vger.kernel.org Sat Feb 07 09:38:36 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1LVihp-0008O0-HE for gcvg-git-2@gmane.org; Sat, 07 Feb 2009 09:38:30 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751936AbZBGIhB (ORCPT ); Sat, 7 Feb 2009 03:37:01 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751589AbZBGIhB (ORCPT ); Sat, 7 Feb 2009 03:37:01 -0500 Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:40598 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbZBGIhA (ORCPT ); Sat, 7 Feb 2009 03:37:00 -0500 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 6D31D973D9; Sat, 7 Feb 2009 03:36:57 -0500 (EST) Received: from pobox.com (unknown [68.225.240.211]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id EC832973D6; Sat, 7 Feb 2009 03:36:53 -0500 (EST) In-Reply-To: (Johannes Schindelin's message of "Fri, 6 Feb 2009 05:00:22 +0100 (CET)") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Pobox-Relay-ID: 7AFB0978-F4F2-11DD-9AFB-8B21C92D7133-77302942!a-sasl-fastnet.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Johannes Schindelin 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.