From 14e940d719e9d3250b802fbc975210dafaf896d8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 3 Mar 2010 14:19:10 -0800 Subject: submodule summary: do not fail before the first commit 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 diff --git a/git-submodule.sh b/git-submodule.sh index 383dc45..9aa57dd 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 Date: Tue, 9 Mar 2010 15:55:32 +0100 Subject: git submodule summary: Handle HEAD as argument when on an unborn branch When calling "git submodule summary HEAD" on an unborn branch the output was empty even when it shouldn't have been ("git submodule summary" without the HEAD argument prints the expected output since commit "submodule summary: do not fail before the first commit"). This also fixes "git status" to emit the "Submodule changes to be committed" section on an unborn branch when used with the status.submodulesummary config option. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano diff --git a/git-submodule.sh b/git-submodule.sh index 9aa57dd..5a9d3c0 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -561,6 +561,7 @@ cmd_summary() { then # before the first commit: compare with an empty tree head=$(git hash-object -w -t tree --stdin