summaryrefslogtreecommitdiff
path: root/t/t7007-show.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-12-15 08:36:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-12-15 09:29:44 (GMT)
commitd2dadfe890b5da6f65fe061a414b6ec67c5efe9c (patch)
tree494ca607f5ff4dd4135e84b4513567fcb79f4a0d /t/t7007-show.sh
parent544ddb045a4bd49da9ffc1d9da80bdc0d71b2518 (diff)
downloadgit-d2dadfe890b5da6f65fe061a414b6ec67c5efe9c.zip
git-d2dadfe890b5da6f65fe061a414b6ec67c5efe9c.tar.gz
git-d2dadfe890b5da6f65fe061a414b6ec67c5efe9c.tar.bz2
git-show: do not segfault when showing a bad tag
When a tag points at a bad or nonexistent object, we should diagnose the breakage and exit. An earlier commit 4f3dcc2 (Fix 'git show' on signed tag of signed tag of commit, 2008-07-01) lost this check and made it segfault instead; not good. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7007-show.sh')
-rwxr-xr-xt/t7007-show.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
new file mode 100755
index 0000000..cce222f
--- /dev/null
+++ b/t/t7007-show.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='git show'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo hello world >foo &&
+ H=$(git hash-object -w foo) &&
+ git tag -a foo-tag -m "Tags $H" $H &&
+ HH=$(expr "$H" : "\(..\)") &&
+ H38=$(expr "$H" : "..\(.*\)") &&
+ rm -f .git/objects/$HH/$H38
+'
+
+test_expect_success 'showing a tag that point at a missing object' '
+ test_must_fail git --no-pager show foo-tag
+'
+
+test_done