X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=d9950c2b7fadef0876867e11ef26283ca1cfaf1e;hb=334fba656b50c92345586970bc6b100a449e1fc5;hp=d3c583d0113e133b8fc75b533ff3f88d2a9c7efe;hpb=48bb30331dc1139a7279d1665cfc76f14b5d0e67;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index d3c583d01..d9950c2b7 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -271,6 +271,8 @@ cmd_foreach() shift done + toplevel=$(pwd) + module_list | while read mode sha1 stage path do @@ -555,12 +557,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