git/t/t7007-show.sh
Junio C Hamano d2dadfe890 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>
2008-12-15 01:29:44 -08:00

21 lines
405 B
Bash
Executable file

#!/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