]> rtime.felk.cvut.cz Git - git.git/blobdiff - git-submodule.sh
Merge branch 'maint-1.7.0' into maint
[git.git] / git-submodule.sh
index e2082fd1492fe34e69c59f0a46cbaf7ddd2e2a8e..3319b836b217a26b4ac55ae5ced328ffafa0a015 100755 (executable)
@@ -21,6 +21,8 @@ command=
 branch=
 reference=
 cached=
+recursive=
+init=
 files=
 nofetch=
 update=
@@ -553,12 +555,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" ]