chiark / gitweb /
test suite: gdr-new-upstream: Break out clog-check-[12]
[dgit.git] / tests / tests / gdr-newupstream
1 #!/bin/bash
2 set -e
3 autoimport=
4 . tests/lib
5
6 t-dependencies NO-DGIT GDR
7
8 t-tstunt-parsechangelog
9 t-setup-import gdr-convert-gbp-noarchive
10
11 cd $p
12
13 : 'upstream hat'
14
15 t-gdr-prep-new-upstream 2.1
16
17 : 'maintainer hat'
18
19 git branch startpoint
20 v=2.1-1
21
22 git checkout master
23
24 t-expect-fail F:'Could not determine appropriate upstream commitish' \
25 t-git-debrebase new-upstream $v
26
27 git tag v2.1 upstream
28
29 git branch before-new-upstream
30
31 clog-check-1 () {
32         before=$1
33         date=$(git log --format=%aD -n1 debian/changelog)
34         git show $before:debian/changelog >../clog.before
35         m="  * Update to new upstream version ${v%-*}."
36         e="dgit test git user <dgit-test@debian.example.net>  $date"
37 }
38 clog-check-2 () {
39         diff -u ../clog.expected debian/changelog
40 }
41
42 : ----- ordinary new upstream test -----
43
44 t-git-debrebase new-upstream ${v%-*}
45
46 clog-check-1 before-new-upstream
47 cat - <<END ../clog.before >../clog.expected
48 example ($v) UNRELEASED; urgency=medium
49
50 $m
51
52  -- $e
53
54 END
55 clog-check-2
56
57 t-gdr-good laundered
58 git reflog | egrep 'debrebase new-upstream.*checkout'
59
60 t-git-debrebase stitch
61 t-gdr-good stitched
62
63 git branch ordinary
64
65 : ----- 'with --anchor' -----
66
67 git checkout -b with-anchor startpoint
68
69 t-git-debrebase analyse >../anal.anch
70 anchor=$(perl <../anal.anch -ne '
71         next unless m/^(\w+) Anchor\s/;
72         print $1,"\n";
73         exit;
74 ')
75
76 GIT_REFLOG_ACTION='STUNT-RLA' \
77 t-git-debrebase --anchor=$anchor -fanchor-treated new-upstream $v upstream
78 t-gdr-good laundered
79 git reflog | egrep 'STUNT-RLA: debrebase new-upstream'
80 git reflog | egrep 'STUNT-RLA: debrebase: launder for new upstream'
81
82 t-git-debrebase stitch
83 t-gdr-good stitched
84
85 git diff --quiet ordinary
86
87 t-ok