chiark / gitweb /
test suite: Add --force-reusing-version to many tests
[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         --force-reusing-version
62 t-git-dir-check secret
63
64 t-policy-periodic
65 t-git-dir-check secret
66
67 t-archive-process-incoming new
68 t-git-dir-time-passes
69
70 t-policy-periodic
71 t-git-dir-check secret
72
73 oldobj=`git rev-parse HEAD`
74 git reset --hard start
75 t-commit 'should require --deliberately..not-ff'
76 t-dgit build
77
78 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
79 t-dgit push
80
81 t-expect-push-fail \
82     "Package is in NEW and has not been accepted or rejected yet" \
83 t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
84
85 t-dgit --deliberately-not-fast-forward --force-reusing-version push
86
87 cd $dgitrepo
88 t-expect-push-fail "Not a valid object name" \
89 git cat-file -p $oldobj
90 cd $tmp/$p
91
92 t-commit 'Still not accepted, will override taint'
93 t-dgit build
94 t-expect-push-fail \
95     "Package is in NEW and has not been accepted or rejected yet" \
96 t-dgit push
97
98 t-dgit push --deliberately-include-questionable-history \
99         --force-reusing-version
100
101 t-archive-process-incoming sid
102
103 t-commit 'Check taint is no longer there'
104 t-dgit build
105 t-dgit push
106
107 git checkout -b stoats $tagpfx/$vanished
108 t-commit 'Simulate accidentally building on rejected version'
109 t-dgit build
110 t-expect-push-fail "HEAD is not a descendant of the archive's version" \
111 t-dgit push
112
113 : "check that uploader can't force it now"
114 t-expect-push-fail "not fast forward on dgit branch" \
115 t-dgit --deliberately-not-fast-forward push
116
117 t-dgit pull
118 t-dgit build
119 t-expect-push-fail \
120     'Reason: rewound suite sid; --deliberately-not-fast-forward specified' \
121 t-dgit --force-reusing-version push
122
123 t-ok