chiark / gitweb /
dgit-maint-gbp(7): Mention --overwrite
[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-dgit setup-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 t-policy-admin taint --global "$bad" "forbidden for testing - again"
22
23 t_expect_push_fail_hook+='
24 t-git-objects-not-present "" $bad
25 '
26
27 t-dgit build
28 t-expect-push-fail 'forbidden for testing' \
29 t-dgit push --new
30 t-git-dir-check enoent
31
32 git reset --hard start
33 t-commit 'will vanish from NEW'
34 vanished=$v
35 t-dgit build
36 t-dgit push --new
37 t-git-dir-check secret
38
39 t-policy-periodic
40 t-git-dir-check secret
41
42 # pretend it vanished from new:
43 rm $tmp/incoming/*
44 t-archive-none example
45
46 t-git-dir-time-passes
47
48 t-policy-periodic
49 t-git-dir-check enoent
50
51 t-commit 'should require --deliberately...questionable'
52 t-dgit build
53
54 t-expect-push-fail E:"tag $tagpfx/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \
55 t-dgit push --new
56 t-git-dir-check enoent
57
58 vanished=$v
59
60 t-dgit push --new --deliberately-include-questionable-history
61 t-git-dir-check secret
62
63 t-policy-periodic
64 t-git-dir-check secret
65
66 t-archive-process-incoming new
67 t-git-dir-time-passes
68
69 t-policy-periodic
70 t-git-dir-check secret
71
72 oldobj=`git rev-parse HEAD`
73 git reset --hard start
74 t-commit 'should require --deliberately..not-ff'
75 t-dgit build
76
77 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
78 t-dgit push
79
80 t-expect-push-fail \
81     "Package is in NEW and has not been accepted or rejected yet" \
82 t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
83
84 t-dgit --deliberately-not-fast-forward push
85
86 cd $dgitrepo
87 t-expect-push-fail "Not a valid object name" \
88 git cat-file -p $oldobj
89 cd $tmp/$p
90
91 t-commit 'Still not accepted, will override taint'
92 t-dgit build
93 t-expect-push-fail \
94     "Package is in NEW and has not been accepted or rejected yet" \
95 t-dgit push
96
97 t-dgit push --deliberately-include-questionable-history
98
99 t-archive-process-incoming sid
100
101 t-commit 'Check taint is no longer there'
102 t-dgit build
103 t-dgit push
104
105 git checkout -b stoats $tagpfx/$vanished
106 t-commit 'Simulate accidentally building on rejected version'
107 t-dgit build
108 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
109 t-dgit push
110
111 : "check that uploader can't force it now"
112 t-expect-push-fail "not fast forward on dgit branch" \
113 t-dgit --deliberately-not-fast-forward push
114
115 t-dgit pull
116 t-dgit build
117 t-expect-push-fail \
118     'Reason: rewound suite sid; --deliberately-not-fast-forward specified' \
119 t-dgit push
120
121 echo ok.