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 <gitster@pobox.com>
Junio C Hamano committed
Mar 3, 2010 at 14:19 UTC
14e940d719e9d3250b802fbc975210dafaf896d8
1 file changed
+2
-1
git-submodule.sh
+2
-1
@@ -559,7 +559,8 @@ cmd_summary() {
559
test $# = 0 || shift
560
elif test -z "$1" -o "$1" = "HEAD"
561
then
562
- return
562
+ # before the first commit: compare with an empty tree
563
+ head=$(git hash-object -w -t tree --stdin </dev/null)
564
else
565
head="HEAD"
566
fi