chiark / gitweb /
test suite: checkout: Check we end up on the right branch each time
[dgit.git] / tests / tests / inarchivecopy
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 t-setup-import examplegit
6 t-tstunt-parsechangelog
7
8 cd $p
9 git checkout -b dgit/stable dgit/dgit/stable
10 cd ..
11
12 t-inarchive-copy () {
13         local vm=$1
14         local from=${2:-sid}
15         local to=${3:-stable}
16         egrep "^${vm//./\\.}" aq/package.$from.$p >>aq/package.$to.$p
17         t-aq-archive-updated $to $p
18 }
19
20 copy-check-good () {
21         git diff $vtag
22         t-refs-same refs/remotes/dgit/dgit/$tosuite
23         t-ref-head
24         t-has-parent-or-is HEAD $vtag
25 }
26
27 copy-check () {
28         local vm=$1
29         local tosuite=${2:-stable}
30         t-inarchive-copy $vm '' $tosuite
31
32         vtag=$(v=$vm t-v-tag)
33
34         cd $p
35          t-refs-same-start
36          t-dgit fetch $tosuite
37          git merge --ff-only dgit/dgit/$tosuite
38
39          copy-check-good
40          local fetched; fetched=$(t-sametree-parent HEAD)
41         cd ..
42
43         rm -rf example.cloned
44         t-dgit clone $p $tosuite example.cloned
45
46         cd example.cloned
47          t-refs-same-start
48          copy-check-good
49          local cloned; cloned=$(t-sametree-parent HEAD)  
50         cd ..
51
52         rm -rf example.initd
53         mkdir example.initd
54         cd example.initd
55          git init
56          t-refs-same-start
57          t-dgit -p $p fetch $tosuite
58          git reset --hard refs/remotes/dgit/dgit/$tosuite
59          copy-check-good
60          local initd; initd=$(t-sametree-parent HEAD)
61         cd ..
62
63         t-refs-same-start
64         t-ref-same-val fetched $fetched
65         t-ref-same-val cloned $cloned
66         t-ref-same-val initd $initd
67 }
68
69 copy-check 2.0
70
71 copy-check 2.1
72
73 cd $p
74 git checkout -b dgit/testing $(v=1.1 t-v-tag)
75 cd ..
76
77 copy-check 2.1 testing
78
79 t-ok