Skip to content

Commit

Permalink
Make sure that index-pack --strict checks tag objects
Browse files Browse the repository at this point in the history
One of the most important use cases for the strict tag object checking
is when transfer.fsckobjects is set to true to catch invalid objects
early on. This new regression test essentially tests the same code path
by directly calling 'index-pack --strict' on a pack containing an
tag object without a 'tagger' line.

Technically, this test is not enough: it only exercises a code path that
*warns*, not one that *fails*. The reason is that hash-object and
pack-objects both insist on parsing the tag objects and would fail on
invalid tag objects at this time.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Sep 12, 2014
1 parent 90e3e5f commit f99b7af
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/t5302-pack-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f99b7af

Please sign in to comment.