summaryrefslogtreecommitdiff
path: root/t/t7401-submodule-summary.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-16 11:21:14 +0100
committerJunio C Hamano <gitster@pobox.com>2010-02-17 11:14:04 -0800
commit3deea89c5feb0dfdfb99ea752f83497d97a3bdd5 (patch)
treed44dac620a12cedcc1e8c73724b166ff35423a78 /t/t7401-submodule-summary.sh
parente923eaeb901ff056421b9007adcbbce271caa7b6 (diff)
downloadgit-3deea89c5feb0dfdfb99ea752f83497d97a3bdd5.tar.gz
submodule summary: Don't barf when invoked in an empty repo
When invoking "git submodule summary" in an empty repo (which can be indirectly done by setting status.submodulesummary = true), it currently emits an error message (via "git diff-index") since HEAD points to an unborn branch. This patch adds handling of the HEAD-points-to-unborn-branch special case, so that "git submodule summary" no longer emits this error message. The patch also adds a test case that verifies the fix. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7401-submodule-summary.sh')
-rwxr-xr-xt/t7401-submodule-summary.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index d3c039f724..cee319da0a 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -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