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