diff --git a/git-submodule.sh b/git-submodule.sh
index d3c583d0113e133b8fc75b533ff3f88d2a9c7efe..3319b836b217a26b4ac55ae5ced328ffafa0a015 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
test $summary_limit = 0 && return
- if rev=$(git rev-parse -q --verify "$1^0")
+ if rev=$(git rev-parse -q --verify --default HEAD ${1+"$1"})
then
head=$rev
- shift
+ test $# = 0 || shift
+ elif test -z "$1" -o "$1" = "HEAD"
+ then
+ # before the first commit: compare with an empty tree
+ head=$(git hash-object -w -t tree --stdin </dev/null)
+ test -z "$1" || shift
else
- head=HEAD
+ head="HEAD"
fi
if [ -n "$files" ]