ls-remote: fall-back to default remotes when no remote specified
[gitweb.git] / git-submodule.sh
index e2082fd1492fe34e69c59f0a46cbaf7ddd2e2a8e..2dd372a21d82a109774e80e014f9959485202b3e 100755 (executable)
@@ -553,12 +553,17 @@ cmd_summary() {
 
        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" ]