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:
commit
490b8ad76f
@ -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" ]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user