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