chiark / gitweb /
changelog: start 9.14
[dgit.git] / tests / tests / quilt-splitbrains
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 suitespecs+=' stable'
6
7 # This test script tests each of the split brain quilt modes, and
8 # --quilt=linear, with a tree suitable for each of those, and pushes
9 # them in sequence.  The idea is to check that each tree is rejected
10 # by the wrong quilt modes, and accepted and processed correctly by
11 # the right ones.
12
13 t-tstunt-parsechangelog
14
15 # Easiest way to make a patches-unapplied but not-gbp tree is
16 # to take the patches-unapplied tree and by-hand commit the .gitignore
17 # changes as a debian patch.
18 t-gbp-example-prep
19
20 suite=sid
21
22 want-success () {
23         local qmode=$1; shift
24         t-refs-same-start
25         t-ref-head
26
27         t-dgit "$@" --quilt=$qmode --dgit-view-save=split.b build-source
28
29         t-dgit "$@" --quilt=$qmode --dgit-view-save=split.p push
30         t-$qmode-pushed-good $suite
31 }
32
33
34 echo "===== testing tree suitable for --quilt=gbp (only) ====="
35
36 t-expect-fail 'git tree differs from result of applying' \
37 t-dgit -wgf --quilt=dpm build-source
38
39 t-expect-fail 'git tree differs from orig in upstream files' \
40 t-dgit -wgf --quilt=unapplied build-source
41
42 t-expect-fail 'This might be a patches-unapplied branch' \
43 t-dgit -wgf build-source
44
45 # testing success with --quilt=gbp are done in quilt-gbp test case
46
47
48 echo "===== making tree suitable for --quilt=unapplied (only) ====="
49
50 pf=debian/patches/test-gitignore
51
52 cat >$pf <<END
53 From: Senatus <spqr@example.com>
54 Subject: Add .gitignore
55
56 ---
57 END
58
59 git diff /dev/null .gitignore >>$pf || test $? = 1
60 echo ${pf##*/} >>debian/patches/series
61
62 git add debian/patches
63 git rm -f .gitignore
64 git commit -m 'Turn gitignore into a debian patch'
65 gitigncommit=`git rev-parse HEAD`
66
67 t-commit unapplied 1.0-3
68
69 echo "----- testing tree suitable for --quilt=unapplied (only) -----"
70
71 t-expect-fail 'git tree differs from result of applying' \
72 t-dgit -wgf --quilt=dpm build-source
73
74 t-expect-fail 'gitignores: but, such patches exist' \
75 t-dgit -wgf --quilt=gbp build-source
76
77 t-expect-fail 'This might be a patches-unapplied branch' \
78 t-dgit -wgf build-source
79
80 want-success unapplied -wgf
81
82
83 echo "===== making fully-applied tree suitable for --quilt-check ====="
84
85 git checkout master
86 git merge --ff-only dgit/dgit/sid
87
88 t-commit vanilla 1.0-4
89
90 echo "----- testing fully-applied tree suitable for --quilt-check -----"
91
92 t-expect-fail 'gitignores: but, such patches exist' \
93 t-dgit --quilt=dpm build-source
94
95 t-expect-fail 'git tree differs from orig in upstream files' \
96 t-dgit --quilt=gbp build-source
97
98 t-expect-fail 'git tree differs from orig in upstream files' \
99 t-dgit --quilt=unapplied build-source
100
101 t-dgit --quilt=nofix build-source
102 t-refs-same-start
103 t-ref-head
104 t-dgit --quilt=nofix push
105 t-pushed-good-core
106
107
108 echo "===== making tree suitable for --quilt=dpm (only) ====="
109
110 git checkout master
111 git merge --ff-only dgit/dgit/sid
112
113 git revert --no-edit $gitigncommit
114
115 t-commit dpmish 1.0-5
116
117 echo "----- testing tree suitable for --quilt=dpm (only) -----"
118
119 t-expect-fail 'git tree differs from orig in upstream files' \
120 t-dgit -wgf --quilt=gbp build-source
121
122 t-expect-fail 'git tree differs from orig in upstream files' \
123 t-dgit -wgf --quilt=unapplied build-source
124
125 t-expect-fail 'This might be a patches-applied branch' \
126 t-dgit -wgf build-source
127
128 want-success dpm
129
130 suite=stable
131 t-commit dpmish-stable 1.0-6 $suite
132
133 want-success dpm --new
134
135 t-ok