Code

grep: support NUL chars in search strings for -F
[git.git] / git-submodule.sh
index f21d0bfce7020edeaed8c0066760e5f55e7facb9..8175cb279d38a663fc0481e2b11f4b5ea60f8a32 100755 (executable)
@@ -21,6 +21,8 @@ command=
 branch=
 reference=
 cached=
+recursive=
+init=
 files=
 nofetch=
 update=
@@ -559,7 +561,9 @@ 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)
+               test -z "$1" || shift
        else
                head="HEAD"
        fi
@@ -646,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)))"
                        ;;