7 local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase}
9 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
10 $gdr $GDR_TEST_OPTS $GDR_TEST_DEBUG $t_gdr_xopts "$@"
11 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
17 local beforetag=$2 # say HEAD to skip this check
18 # state should be one of
23 git diff --quiet ${beforetag-t.before} -- ':.' ':!debian/patches'
27 LC_MESSAGES=C t-git-debrebase status >../status.check
30 egrep '^ *branch is laundered' ../status.check
34 '^ *branch contains furniture|^ *branch is unlaundered|^ *branch needs laundering' ../status.check
35 egrep '^ stitched$' ../status.check
39 # etypes is either a type,
40 # or PseudoMerge-<more etypes>
41 # or AddPatches-<more etypes>
46 bwtip=Y:`t-git-debrebase breakwater`
48 stitched) etypes=Pseudomerge-Upstream ;;
49 pushed) etypes=AddPatches-Pseudomerge-Upstream ;;
50 pushed-interop) etypes=Pseudomerge-AddPatchesInterop-Upstream ;;
53 t-git-debrebase analyse >../anal.check
54 expect=`git rev-parse HEAD`
56 local cid ctype info nparents
57 while read cid ctype info; do
58 : ===== $cid $ctype $info =====
60 local cetype=${etypes%%-*}
61 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
62 local parents="`git log -n1 --pretty=format:%P $cid`"
65 : "$ctype/$cetype" "$parents"
67 case "$ctype/$cetype" in
70 Packaging/Upstream) ;;
72 AddPatches/AddPatchesInterop) ;;
73 Changelog/Packaging) ;;
74 Changelog/Upstream) ;;
79 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
83 case "$ctype/$etypes" in
86 if [ "x$bwtip" != x ]; then
87 test "$bwtip" = "Y:$cid"
94 git log -n1 --pretty=format:%B \
95 | grep '^\[git-debrebase[ :]'
101 expect=${info#Contributor=}
104 git diff --quiet $expect..$cid
107 : 'reject pointless pseudomerges'
108 local overwritten=${parents/$expect/}
109 overwritten=${overwritten// /}
110 t-git-debrebase analyse $overwritten >../anal.overwr
111 local ocid otype oinfo
112 read <../anal.overwr ocid otype oinfo
114 Pseudomerge) test "x$info" != "x$oinfo" ;;
118 git diff --quiet $expect..$cid -- ':.' ':!debian'
119 git diff --quiet $expect..$cid -- ':debian/patches'
123 git diff --quiet $expect..$cid -- \
124 ':.' ':!debian/patches'
128 git diff --quiet $expect..$cid -- \
129 ':.' ':!debian/changelog'
133 git diff --quiet $expect..$cid -- ':debian'
140 local cnparents=`printf "%s" "$parents" | wc -w`
141 test $cnparents = $enparents
144 for f in $parents; do echo $f; done | t-sort -u | wc -w
146 test $cndparents = $cnparents
150 *) fail 'unexpected parent' ;;
164 echo >>debian/zorkmid "// debian $token"
165 git add debian/zorkmid
166 git commit -m "DEBIAN add zorkmid ($token)"
172 echo >>src.c "// upstream $token"
173 git commit -a -m "UPSTREAM edit src.c ($token)"
179 for f in debian/zorkmid src.c; do
180 echo "// both! $token" >>$f
183 git commit -m "MIXED add both ($token)"
190 t-make-new-upstream-tarball () {
192 git checkout make-upstream
193 # leaves ust set to filename of orig tarball
194 echo "upstream $uv" >>docs/README
195 git commit -a -m "upstream $uv tarball"
196 ust=example_$uv.orig.tar.gz
197 git archive -o ../$ust --prefix=example-2.0/ make-upstream
203 # nmu-upload-1 <nmubranch>
204 # gbp pq import or perhaps other similar things
206 # maybe make some dgit-covertible commits
211 git checkout -f -b $nmubranch
213 t-git-debrebase convert-to-gbp
215 # now we are on a gbp patched-unapplied branch
221 t-dch-commit -v $v -m "nmu $nmubranch $v"
227 t-dgit -wgf build-source
230 c=${p}_${v}_source.changes
231 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
232 dput -c $tmp/dput.cf test-dummy $c
234 t-archive-process-incoming sid
240 t-nmu-commit-an-upstream-change () {
241 echo >>newsrc.c "// more upstream"
243 git commit -m 'UPSTREAM NMU'
246 t-maintainer-commit-some-changes () {
247 t-dch-commit -v$v -m "start $v"
249 t-some-changes "maintainer $v"
251 t-git-debrebase stitch
253 git branch did.maintainer
258 t-nmu-causes-ff-fail () {
261 t-expect-fail E:'Not.*fast-forward' \
262 git merge --ff-only dgit/dgit/sid
264 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
268 t-nmu-reconciled-good () {
271 : 'check that what we have is what is expected'
273 git checkout -b compare.nmu origin/master~0
274 git checkout $nmutree .
275 git rm -rf debian/patches
276 git commit -m 'rm patches nmu'
278 git checkout -b compare.maintainer origin/master~0
279 git checkout did.maintainer .
280 git rm -rf --ignore-unmatch debian/patches
281 git commit --allow-empty -m 'rm patches maintainer'
283 git merge compare.nmu
284 git diff --quiet master
286 : 'check that dgit still likes it'
289 t-dgit -wgf quilt-fixup