summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-09-26 14:39:43 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-09-26 14:39:43 -0700
commit13f4f046929de00a8c16171c5e08cdcae887b54d (patch)
tree44af90db2087ad26f7ecb7c2ad0007a503a3bc40 /t
parentMerge branch 'jk/faster-name-conflicts' (diff)
parentMake sure that index-pack --strict checks tag objects (diff)
downloadtgif-13f4f046929de00a8c16171c5e08cdcae887b54d.tar.xz
Merge branch 'js/fsck-tag-validation'
Teach "git fsck" to inspect the contents of annotated tag objects. * js/fsck-tag-validation: Make sure that index-pack --strict checks tag objects Add regression tests for stricter tag fsck'ing fsck: check tag objects' headers Make sure fsck_commit_buffer() does not run out of the buffer fsck_object(): allow passing object data separately from the object itself Refactor type_from_string() to allow continuing after detecting an error
Diffstat (limited to 't')
-rwxr-xr-xt/t1450-fsck.sh19
-rwxr-xr-xt/t5302-pack-index.sh19
2 files changed, 38 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index b52397afd3..c23408ec07 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -214,6 +214,25 @@ test_expect_success 'tag pointing to something else than its type' '
test_must_fail git fsck --tags
'
+test_expect_success 'tag with incorrect tag name & missing tagger' '
+ sha=$(git rev-parse HEAD) &&
+ cat >wrong-tag <<-EOF &&
+ object $sha
+ type commit
+ tag wrong name format
+
+ This is an invalid tag.
+ EOF
+
+ tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
+ test_when_finished "remove_object $tag" &&
+ echo $tag >.git/refs/tags/wrong &&
+ test_when_finished "git update-ref -d refs/tags/wrong" &&
+ git fsck --tags 2>out &&
+ grep "invalid .tag. name" out &&
+ grep "expected .tagger. line" out
+'
+
test_expect_success 'cleaned up' '
git fsck >actual 2>&1 &&
test_cmp empty actual
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 4bbb718751..61bc8da560 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -243,4 +243,23 @@ test_expect_success 'running index-pack in the object store' '
test -f .git/objects/pack/pack-${pack1}.idx
'
+test_expect_success 'index-pack --strict warns upon missing tagger in tag' '
+ sha=$(git rev-parse HEAD) &&
+ cat >wrong-tag <<EOF &&
+object $sha
+type commit
+tag guten tag
+
+This is an invalid tag.
+EOF
+
+ tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
+ pack1=$(echo $tag $sha | git pack-objects tag-test) &&
+ echo remove tag object &&
+ thirtyeight=${tag#??} &&
+ rm -f .git/objects/${tag%$thirtyeight}/$thirtyeight &&
+ git index-pack --strict tag-test-${pack1}.pack 2>err &&
+ grep "^error:.* expected .tagger. line" err
+'
+
test_done