chiark / gitweb /
Avoid use of "my $_", which is not portable
[dgit.git] / tests / tests / debpolicy-newreject
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-tstunt-parsechangelog
6
7 t-debpolicy
8 t-prep-newpackage example 1.0
9
10 cd $p
11 revision=1
12 git tag start
13 t-prep-mergechangelogs
14
15 echo FORBIDDEN >debian/some-file
16 git add debian/some-file
17 t-commit 'Commit a forbidden thing'
18
19 bad=`git rev-parse HEAD:debian/some-file`
20 t-policy-admin taint --global "$bad" "forbidden for testing"
21
22 t_expect_push_fail_hook+='
23 t-git-objects-not-present "" $bad
24 '
25
26 t-dgit build
27 t-expect-push-fail 'forbidden for testing' \
28 t-dgit push --new
29 t-git-dir-check enoent
30
31 git reset --hard start
32 t-commit 'will vanish from NEW'
33 vanished=$v
34 t-dgit build
35 t-dgit push --new
36 t-git-dir-check secret
37
38 t-policy-periodic
39 t-git-dir-check secret
40
41 # pretend it vanished from new:
42 rm $tmp/incoming/*
43 t-archive-none example
44
45 t-git-dir-time-passes
46
47 t-policy-periodic
48 t-git-dir-check enoent
49
50 t-commit 'should require --deliberately...questionable'
51 t-dgit build
52
53 t-expect-push-fail E:"tag debian/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \
54 t-dgit push --new
55 t-git-dir-check enoent
56
57 vanished=$v
58
59 t-dgit push --new --deliberately-include-questionable-history
60 t-git-dir-check secret
61
62 t-policy-periodic
63 t-git-dir-check secret
64
65 t-archive-process-incoming new
66 t-git-dir-time-passes
67
68 t-policy-periodic
69 t-git-dir-check secret
70
71 oldobj=`git rev-parse HEAD`
72 git reset --hard start
73 t-commit 'should require --deliberately..not-ff'
74 t-dgit build
75
76 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
77 t-dgit push
78
79 t-expect-push-fail \
80     "Package is in NEW and has not been accepted or rejected yet" \
81 t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
82
83 t-dgit --deliberately-not-fast-forward push
84
85 cd $tmp/git/$p.git
86 t-expect-push-fail "Not a valid object name" \
87 git cat-file -p $oldobj
88 cd $tmp/$p
89
90 t-commit 'Still not accepted, will override taint'
91 t-dgit build
92 t-expect-push-fail \
93     "Package is in NEW and has not been accepted or rejected yet" \
94 t-dgit push
95
96 t-dgit push --deliberately-include-questionable-history
97
98 t-archive-process-incoming sid
99
100 t-commit 'Check taint is no longer there'
101 t-dgit build
102 t-dgit push
103
104 git checkout -b stoats debian/$vanished
105 t-commit 'Simulate accidentally building on rejected version'
106 t-dgit build
107 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
108 t-dgit push
109
110 : "check that uploader can't force it now"
111 t-expect-push-fail "not fast forward on dgit branch" \
112 t-dgit --deliberately-not-fast-forward push
113
114 t-dgit pull
115 t-dgit build
116 t-expect-push-fail \
117     'Reason: rewound suite sid; --deliberately-not-fast-forward specified' \
118 t-dgit push
119
120 echo ok.