Merge branch 'jh/maint-submodule-status-in-void'

* jh/maint-submodule-status-in-void:
  submodule summary: Don't barf when invoked in an empty repo
This commit is contained in:
Junio C Hamano 2010-03-02 12:44:07 -08:00
commit 490b8ad76f
2 changed files with 12 additions and 2 deletions

View File

@ -553,12 +553,15 @@ 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
elif test -z "$1" -o "$1" = "HEAD"
then
return
else
head=HEAD
head="HEAD"
fi
if [ -n "$files" ]

View File

@ -227,4 +227,11 @@ test_expect_success 'fail when using --files together with --cached' "
test_must_fail git submodule summary --files --cached
"
test_expect_success 'should not fail in an empty repo' "
git init xyzzy &&
cd xyzzy &&
git submodule summary >output 2>&1 &&
test_cmp output /dev/null
"
test_done