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

[PATCH 1/2] submodule summary: do not shift a non-existent positional variable

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2010, 22:19 UTC
Message-ID
<1267654750-30911-1-git-send-email-gitster@pobox.com>
From: Jeff King <peff@peff.net>

When "git submodule summary" is run without any argument, we default to compare the state of index with the HEAD, but tried to shift out $1 that does not exist (and worse yet, we didn't use it).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-submodule.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 5869c00..383dc45 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 $# = 0 || shift
 	elif test -z "$1" -o "$1" = "HEAD"
 	then
 		return
-- 
1.7.0.1.290.g2d87e
Next: Junio C Hamano
Message 1 of 4 in “submodule summary: do not shift a non-existent positional variable”
  1. 1/2 submodule summary: do not shift a non-existent positional variableJunio C Hamano, Mar 3, 2010
  2. 2/2 submodule summary: do not fail before the first commitJunio C Hamano, Mar 3, 2010
  3. Johan HerlandMar 3, 2010
  4. Johan HerlandMar 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.