summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-03 14:19:10 -0800
committerJunio C Hamano <gitster@pobox.com>2010-03-03 14:33:22 -0800
commit14e940d719e9d3250b802fbc975210dafaf896d8 (patch)
tree68cfa9a84ab1ddb464d01f603764f993a16a6171 /git-submodule.sh
parentcaa9c3cabe9c2719a340425db5c0968fd3588fc9 (diff)
downloadgit-14e940d719e9d3250b802fbc975210dafaf896d8.tar.gz
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>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 383dc45119..9aa57dd6f7 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