1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-09 09:26:35 +02:00

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>
This commit is contained in:
Junio C Hamano 2010-03-03 14:19:10 -08:00
parent caa9c3cabe
commit 14e940d719

View File

@ -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