From 3fde94933fce6b3b0bfefda8d7dab486a6d22bc8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 12 Mar 2014 18:34:43 +0000 Subject: [PATCH] tests: drs-push-rejects: malformed tags of various kinds --- tests/tests/drs-push-rejects | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/tests/tests/drs-push-rejects b/tests/tests/drs-push-rejects index 73de5eca..36d4dab9 100755 --- a/tests/tests/drs-push-rejects +++ b/tests/tests/drs-push-rejects @@ -71,6 +71,39 @@ tag_signer='-a' mktag mustfail 'missing signature' $push_spec +git cat-file tag $tag_name >goodtag + +for h in object type tag; do + for how in missing dupe; do + + case $how in + missing) perl -pe 's/^tag /wombat$&/ if 1..m/^$/' badtag ;; + dupe) perl -pe 'print if 1..m/^$/ and m/^'$h' /' badtag ;; + esac + + rm -f badtag.asc + gpg --detach-sign --armor -u Senatus badtag + cat badtag.asc >>badtag + + set +e + LC_ALL=C git hash-object -w -t tag badtag >badtag.hash 2>badtag.err + rc=$? + set -e + + if [ $rc = 128 ] && grep 'fatal: corrupt tag' badtag.err; then + continue + elif [ $rc != 0 ]; then + cat badtag.err + fail "could not make tag" + fi + + read