14 local wantmsg="$1"; shift
15 t-reporefs >$tmp/show-refs.pre-push
17 git push origin "$@" 2>&1 |tee $tmp/mustfail.txt
21 "0 0") fail "push unexpectedly succeeded (instead of: $wantmsg)" ;;
23 *) fail "tee failed" ;;
25 if ! fgrep "$wantmsg" $tmp/mustfail.txt >/dev/null; then
26 fail "error message not found"
28 t-reporefs >$tmp/show-refs.post-push
29 diff $tmp/show-refs.{pre,post}-push
33 t-reporefs >$tmp/show-refs.pre-push
35 t-reporefs >$tmp/show-refs.post-push
36 if diff $tmp/show-refs.{pre,post}-push >$tmp/show-refs.diff; then
37 fail "no refs updated"
44 cp $tmp/masters/* $tmp/.
45 tag_signer='-u Senatus'
46 tag_message="$p release $version for $suite ($csuite) [dgit]"
47 tag_name=debian/$version
48 push_spec1="HEAD:refs/dgit/$csuite"
49 push_spec2="refs/tags/$tag_name"
50 push_spec="$push_spec1 $push_spec2"
53 git tag -f $tag_signer -m "$tag_message" $tag_name "$@"
57 cp $tmp/d[dm].* $tmp/masters
64 mustfail 'missing signature' $push_spec
66 git cat-file tag $tag_name >goodtag
68 for h in object type tag; do
69 for how in missing dupe; do
72 missing) perl -pe 's/^tag /wombat$&/ if 1..m/^$/' <goodtag >badtag ;;
73 dupe) perl -pe 'print if 1..m/^$/ and m/^'$h' /' <goodtag >badtag ;;
77 gpg --detach-sign --armor -u Senatus badtag
78 cat badtag.asc >>badtag
81 LC_MESSAGES=C git hash-object -w -t tag badtag >badtag.hash 2>badtag.err
85 if [ $rc = 128 ] && grep 'fatal: corrupt tag' badtag.err; then
87 elif [ $rc != 0 ]; then
89 fail "could not make tag"
92 read <badtag.hash badtag
93 git update-ref refs/tags/$tag_name $badtag
95 mustfail 'multiple headers '$h' in signed tag object' $push_spec
100 tag_message='something'
102 mustfail 'tag message not in expected format' $push_spec
106 mustfail 'sid != sponge' HEAD:refs/dgit/sponge $push_spec2
108 # fixme test --sig-policy-url string
109 # fixme cannot test reject "signature is not of type 00!";
113 mustfail 'push is missing tag ref update' $push_spec1
114 mustfail 'push is missing head ref update' $push_spec2
115 mustfail 'pushing unexpected ref' $push_spec HEAD:refs/wombat
116 mustfail 'pushing multiple heads' $push_spec HEAD:refs/dgit/wombat
117 mustfail 'pushing multiple tags' $push_spec HEAD:refs/tags/debian/wombat
121 echo woody >$tmp/suites
122 mustfail 'unknown suite' $push_spec
123 cp $root/tests/suites $tmp/.
126 # or reject "command string not understood";
127 # reject "unknown method" unless $mainfunc;
132 cp $tmp/dm.gpg $tmp/dd.gpg
133 mustfail 'key not found in keyrings' $push_spec
137 mustfail 'tag refers to wrong commit' $push_spec
141 mustfail 'tag refers to wrong kind of object' $push_spec
144 tag_name=debian/wombat
146 #git update-ref debian/$version debian/wombat
147 mustfail 'tag name in tag is wrong' \
148 refs/tags/debian/wombat:refs/tags/debian/$version $push_spec1
152 mustsucceed $push_spec # succeeds
155 mustfail 'push is missing head ref update' $push_spec
157 git commit --allow-empty -m 'Dummy update'
159 mustfail 'not replacing previously-pushed version' $push_spec
160 git reset --hard HEAD~
165 next unless m/^fingerprint: 3A82860837A0CD32/i../^$/;
166 ' -e "$1" $tmp/dm.txt
167 tag_signer='-u Populus'
171 git commit --amend --message 'Make it not a fast forward'
175 mustfail 'not fast forward on dgit branch' +$push_spec1 +$push_spec2
181 perl -i.bak -ne 'print if 1..s/(pari-extra).*\n/$1/' $tmp/dm.txt
182 mustfail '' $push_spec # malformed (truncated) dm.txt; don't care about msg
184 prep_dm_mangle 's/allow:/asponge:/i'
185 mustfail 'missing Allow section in permission' $push_spec
187 prep_dm_mangle 's/\bpari-extra\b/sponge/i'
188 mustfail "package $p not allowed for key" $push_spec
190 prep_dm_mangle 'y/0-9/5-90-4/ if m/^fingerprint:/i'
191 mustfail "not in permissions list although in keyring" $push_spec
194 mustsucceed $push_spec # succeeds