Skip to content

Commit 5e4f614

Browse files
committed
Merge branch 'jh/maint-submodule-status-in-void'
* jh/maint-submodule-status-in-void: git submodule summary: Handle HEAD as argument when on an unborn branch submodule summary: do not fail before the first commit
2 parents a86ed83 + 2ea6c2c commit 5e4f614

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-submodule.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ cmd_summary() {
559559
test $# = 0 || shift
560560
elif test -z "$1" -o "$1" = "HEAD"
561561
then
562-
return
562+
# before the first commit: compare with an empty tree
563+
head=$(git hash-object -w -t tree --stdin </dev/null)
564+
test -z "$1" || shift
563565
else
564566
head="HEAD"
565567
fi

0 commit comments

Comments
 (0)