]> rtime.felk.cvut.cz Git - git.git/blobdiff - git-submodule.sh
Merge branch 'maint'
[git.git] / git-submodule.sh
index d3c583d0113e133b8fc75b533ff3f88d2a9c7efe..8175cb279d38a663fc0481e2b11f4b5ea60f8a32 100755 (executable)
@@ -555,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" ]
@@ -645,7 +650,7 @@ cmd_summary() {
                                range=$sha1_dst
                        fi
                        GIT_DIR="$name/.git" \
-                       git log --pretty=oneline --first-parent $range | wc -l
+                       git rev-list --first-parent $range -- | wc -l
                        )
                        total_commits=" ($(($total_commits + 0)))"
                        ;;