git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] submodule summary: do not shift a non-existent positional variable
@ 2010-03-03 22:19 Junio C Hamano
  2010-03-03 22:19 ` [PATCH 2/2] submodule summary: do not fail before the first commit Junio C Hamano
  2010-03-03 23:12 ` [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Johan Herland
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2010-03-03 22:19 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] submodule summary: do not fail before the first commit
  2010-03-03 22:19 [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Junio C Hamano
@ 2010-03-03 22:19 ` Junio C Hamano
  2010-03-03 23:12   ` Johan Herland
  2010-03-03 23:12 ` [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Johan Herland
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2010-03-03 22:19 UTC (permalink / raw)
  To: git

When "git status" collects changes for the index (usually relative to
HEAD), it compares the index with an empty tree when the repository does
not have an initial commit yet.  "git submodule summary" is about asking
what submodule changes would be recorded if a commit is made right now,
and should do the same comparison to report all the added submodules,
instead of punting and being silent.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-submodule.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 383dc45..eab2549 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -559,7 +559,8 @@ cmd_summary() {
 		test $# = 0 || shift
 	elif test -z "$1" -o "$1" = "HEAD"
 	then
-		return
+		# before the first commit: compare with an empty tree
+		head=$(git hash-object -w -t tree --stdin </dev/null)
 	else
 		head="HEAD"
 	fi
-- 
1.7.0.1.290.g2d87e

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] submodule summary: do not shift a non-existent positional variable
  2010-03-03 22:19 [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Junio C Hamano
  2010-03-03 22:19 ` [PATCH 2/2] submodule summary: do not fail before the first commit Junio C Hamano
@ 2010-03-03 23:12 ` Johan Herland
  1 sibling, 0 replies; 4+ messages in thread
From: Johan Herland @ 2010-03-03 23:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wednesday 03 March 2010, Junio C Hamano wrote:
> 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>

Acked-by: Johan Herland <johan@herland.net>


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] submodule summary: do not fail before the first commit
  2010-03-03 22:19 ` [PATCH 2/2] submodule summary: do not fail before the first commit Junio C Hamano
@ 2010-03-03 23:12   ` Johan Herland
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Herland @ 2010-03-03 23:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

On Wednesday 03 March 2010, Junio C Hamano wrote:
> When "git status" collects changes for the index (usually relative to
> HEAD), it compares the index with an empty tree when the repository does
> not have an initial commit yet.  "git submodule summary" is about asking
> what submodule changes would be recorded if a commit is made right now,
> and should do the same comparison to report all the added submodules,
> instead of punting and being silent.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Acked-by: Johan Herland <johan@herland.net>


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-03 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03 22:19 [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Junio C Hamano
2010-03-03 22:19 ` [PATCH 2/2] submodule summary: do not fail before the first commit Junio C Hamano
2010-03-03 23:12   ` Johan Herland
2010-03-03 23:12 ` [PATCH 1/2] submodule summary: do not shift a non-existent positional variable Johan Herland

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).