#!/bin/bash set -e . tests/lib t-drs t-git-none p=pari-extra t-worktree drs cd $p reporefs () { (set -e if test -d $tmp/git/$p.git; then cd $tmp/git/$p.git git show-ref fi) } mustfail () { local wantmsg="$1"; shift reporefs >$tmp/show-refs.pre-push set +e git push origin "$@" 2>&1 |tee $tmp/mustfail.txt ps="${PIPESTATUS[*]}" set -e case $ps in "0 0") fail "push unexpectedly succeeded (instead of: $wantmsg)" ;; *" 0") ;; *) fail "tee failed" ;; esac if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then fail "error message not found" fi reporefs >$tmp/show-refs.post-push diff $tmp/show-refs.{pre,post}-push } mustsucceed () { reporefs >$tmp/show-refs.pre-push git push origin "$@" reporefs >$tmp/show-refs.post-push if diff $tmp/show-refs.{pre,post}-push >$tmp/show-refs.diff; then fail "no refs updated" fi } prep () { local suite=$1 local csuite=$2 cp $tmp/masters/* $tmp/. tag_signer='-u Senatus' tag_message="$p release $version for $suite ($csuite) [dgit]" tag_name=debian/$version push_spec1="HEAD:refs/dgit/$csuite" push_spec2="refs/tags/$tag_name" push_spec="$push_spec1 $push_spec2" } mktag () { git tag -f $tag_signer -m "$tag_message" $tag_name "$@" } mkdir $tmp/masters cp $tmp/d[dm].* $tmp/masters version=3-2_dummy1 prep unstable sid 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