summaryrefslogtreecommitdiff
path: root/tests/tests/quilt-splitbrains
blob: 6886cf89652d6a222b0eb3b38aa36df58581af3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
set -e
. tests/lib

suitespecs+=' stable'

# This test script tests each of the split brain quilt modes, and
# --quilt=linear, with a tree suitable for each of those, and pushes
# them in sequence.  The idea is to check that each tree is rejected
# by the wrong quilt modes, and accepted and processed correctly by
# the right ones.

t-tstunt-parsechangelog

t-newtag

# Easiest way to make a patches-unapplied but not-gbp tree is
# to take the patches-unapplied tree and by-hand commit the .gitignore
# changes as a debian patch.
t-gbp-example-prep

suite=sid

want-success () {
	local qmode=$1; shift
	t-refs-same-start
	t-ref-head

	t-dgit "$@" --quilt=$qmode --dgit-view-save=split.b build-source

	t-dgit "$@" --quilt=$qmode --dgit-view-save=split.p push
	t-$qmode-pushed-good
}


echo "===== testing tree suitable for --quilt=gbp (only) ====="

t-expect-fail 'git tree differs from result of applying' \
t-dgit -wgf --quilt=dpm build-source

t-expect-fail 'git tree differs from orig in upstream files' \
t-dgit -wgf --quilt=unapplied build-source

t-expect-fail 'This might be a patches-unapplied branch' \
t-dgit -wgf build-source

# testing success with --quilt=gbp are done in quilt-gbp test case


echo "===== making tree suitable for --quilt=unapplied (only) ====="

pf=debian/patches/test-gitignore

cat >$pf <<END
From: Senatus <spqr@example.com>
Subject: Add .gitignore

---
END

git diff /dev/null .gitignore >>$pf || test $? = 1
echo ${pf##*/} >>debian/patches/series

git add debian/patches
git rm -f .gitignore
git commit -m 'Turn gitignore into a debian patch'
gitigncommit=`git rev-parse HEAD`

t-commit unapplied 1.0-3

echo "----- testing tree suitable for --quilt=unapplied (only) -----"

t-expect-fail 'git tree differs from result of applying' \
t-dgit -wgf --quilt=dpm build-source

t-expect-fail 'gitignores: but, such patches exist' \
t-dgit -wgf --quilt=gbp build-source

t-expect-fail 'This might be a patches-unapplied branch' \
t-dgit -wgf build-source

want-success unapplied -wgf


echo "===== making fully-applied tree suitable for --quilt-check ====="

git checkout master
git merge --ff-only dgit/dgit/sid

t-commit vanilla 1.0-4

echo "----- testing fully-applied tree suitable for --quilt-check -----"

t-expect-fail 'gitignores: but, such patches exist' \
t-dgit --quilt=dpm build-source

t-expect-fail 'git tree differs from orig in upstream files' \
t-dgit --quilt=gbp build-source

t-expect-fail 'git tree differs from orig in upstream files' \
t-dgit --quilt=unapplied build-source

t-dgit --quilt=nofix build-source
t-refs-same-start
t-ref-head
t-dgit --quilt=nofix push
t-pushed-good-core


echo "===== making tree suitable for --quilt=dpm (only) ====="

git checkout master
git merge --ff-only dgit/dgit/sid

git revert --no-edit $gitigncommit

t-commit dpmish 1.0-5

echo "----- testing tree suitable for --quilt=dpm (only) -----"

t-expect-fail 'git tree differs from orig in upstream files' \
t-dgit -wgf --quilt=gbp build-source

t-expect-fail 'git tree differs from orig in upstream files' \
t-dgit -wgf --quilt=unapplied build-source

t-expect-fail 'This might be a patches-applied branch' \
t-dgit -wgf build-source

want-success dpm

suite=stable
t-commit dpmish-stable 1.0-6 $suite

want-success dpm --new

t-ok