git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johan Herland <johan@herland.net>,
	A Large Angry SCM <gitzilla@gmail.com>, git <git@vger.kernel.org>
Subject: Re: Latest master failing t7401 submodule tests
Date: Wed, 3 Mar 2010 15:42:57 -0500	[thread overview]
Message-ID: <20100303204257.GA5501@coredump.intra.peff.net> (raw)
In-Reply-To: <7vhboxno38.fsf@alter.siamese.dyndns.org>

On Wed, Mar 03, 2010 at 12:32:11PM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > I did see it on my debian unstable box with with dash as /bin/sh (though
> 
> 3deea89 (submodule summary: Don't barf when invoked in an empty repo,
> 2010-02-16) looks broken.  It shifts $1 unconditionally when:

Yeah, I can confirm that the breakage was introduced there (and it looks
like for bash, an extra "shift" is a failing command but doesn't make
the shell barf, but for dash it is more serious, which explains why
tests passed for you).

>  - "git submodule summary", no arguments given and defaults to HEAD which
>    is _not_ unborn (we shouldn't shift in this case);

Yes, definitely a bug.

>  - "git submodule summary HEAD path...", which is not unborn (we should shift);

Yes, and I think we do that part right.

>  - "git submodule summary path...", defaults to HEAD which is _not_ unborn
>    (we shouldn't shift).

I don't think this is a problem. We do:

  git rev-parse -q --verify --default HEAD path

and it correctly reports failure, so we never do the problematic shift.

So I think we just need

diff --git a/git-submodule.sh b/git-submodule.sh
index 1ea4143..bf5ea50 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -556,7 +556,7 @@ cmd_summary() {
 	if rev=$(git rev-parse -q --verify --default HEAD ${1+"$1"})
 	then
 		head=$rev
-		shift
+		test -n "$1" && shift
 	elif test -z "$1" -o "$1" = "HEAD"
 	then
 		return

-Peff

  reply	other threads:[~2010-03-03 20:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03 12:21 Latest master failing t7401 submodule tests A Large Angry SCM
2010-03-03 19:45 ` Junio C Hamano
2010-03-03 20:02   ` Jeff King
2010-03-03 20:32     ` Junio C Hamano
2010-03-03 20:42       ` Jeff King [this message]
2010-03-03 21:04         ` Junio C Hamano
2010-03-03 21:28           ` Junio C Hamano
2010-03-03 21:58             ` What should "git submodule summary" give before an initial commit? Junio C Hamano
2010-03-03 23:10               ` Johan Herland
2010-03-04  0:36               ` Jens Lehmann
2010-03-04  6:01                 ` Sverre Rabbelier
2010-03-04  6:22                   ` Junio C Hamano
2010-03-04  6:36                     ` Sverre Rabbelier
2010-03-04  6:43                       ` Junio C Hamano
2010-03-04  6:48                         ` Sverre Rabbelier
2010-03-03 22:57             ` Latest master failing t7401 submodule tests Jeff King
2010-03-03 20:52       ` Junio C Hamano

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=20100303204257.GA5501@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gitzilla@gmail.com \
    --cc=johan@herland.net \
    /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).