Skip to content

Commit

Permalink
submodule summary: do not fail before the first commit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Mar 3, 2010
1 parent caa9c3c commit 14e940d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14e940d

Please sign in to comment.