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

Re: Latest master failing t7401 submodule tests

From
Jeff King <peff@peff.net>
Date
Mar 3, 2010, 20:42 UTC
Message-ID
<20100303204257.GA5501@coredump.intra.peff.net>
In-Reply-To
<7vhboxno38.fsf@alter.siamese.dyndns.org>
On Wed, Mar 03, 2010 at 12:32:11PM -0800, Junio C Hamano wrote:
Show 6 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 17 in “Latest master failing t7401 submodule tests”
  1. A Large Angry SCMMar 3, 2010
  2. Junio C HamanoMar 3, 2010
  3. Jeff KingMar 3, 2010
  4. Junio C HamanoMar 3, 2010
  5. Jeff KingMar 3, 2010
  6. Junio C HamanoMar 3, 2010
  7. Junio C HamanoMar 3, 2010
  8. What should "git submodule summary" give before an initial commit?Junio C Hamano, Mar 3, 2010
  9. Johan HerlandMar 3, 2010
  10. Jens LehmannMar 4, 2010
  11. Sverre RabbelierMar 4, 2010
  12. Junio C HamanoMar 4, 2010
  13. Sverre RabbelierMar 4, 2010
  14. Junio C HamanoMar 4, 2010
  15. Sverre RabbelierMar 4, 2010
  16. Jeff KingMar 3, 2010
  17. Junio C HamanoMar 3, 2010

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.