chiark / gitweb /
test suite: checkout: Check we end up on the right branch each time
[dgit.git] / tests / tests / downstream-gitless
1 #!/bin/bash
2 set -e
3 . tests/lib
4 . $troot/lib-reprepro
5
6 t-dependencies reprepro
7 t-setup-import examplegit
8 t-tstunt-parsechangelog
9
10
11 # rewrite some things, so we test the rewriting code
12
13 mkdir map
14 cd map
15 git init
16 cd ..
17
18 record-map () {
19         old=$(t-git-get-ref-exact "refs/original/$r")
20         new=$(t-git-get-ref-exact "$r")
21         if [ "$old" = "$new" ]; then return; fi
22         echo >>$tmp/map/map "$old $new"
23 }
24
25 filter () {
26         git filter-branch                               \
27                 --msg-filter 'sed s/Sid/Spong/'         \
28                 --tag-name-filter cat                   \
29                 ^archive/test-dummy/2.0                 \
30                 "$@"
31         for r in "$@"; do
32                 record-map "$r"
33         done
34 }
35
36 cd $p
37 filter                          \
38   refs/heads/master             \
39   refs/remotes/dgit/dgit/sid
40
41 t-ref-head
42
43 cd ../git/$p.git
44 filter                          \
45   refs/dgit/sid
46
47 cd $tmp/map
48 git add map
49 git commit -m 'by test suite'
50 git push $tmp/git/$p.git master:refs/dgit-rewrite/map
51 cd ..
52
53
54 suitespecs=avon
55 t-reprepro-cfg ds- downstream
56 t-reprepro-setup ds-
57 distro=''
58
59
60 dscf=$tmp/mirror/pool/main/example_1.1.dsc
61 t-reprepro-includedsc avon $dscf ds-
62 t-reprepro-regen ds-
63
64
65 mkdir $p.import
66 cd $p.import
67 git init
68 t-dgit import-dsc $dscf x
69 cd ..
70
71 t-git-config dgit-suite.avon.distro downstream
72 t-git-config dgit-distro.downstream.git-check false
73
74 t-dgit clone example avon example.avon
75
76
77 perl -i -pe 's/ test-dummy / unknown-distro / if m/^Dgit:/' $dscf
78 cd $p.import
79
80 t-expect-fail 'hinted url with protocol file which is unsafe' \
81 t-dgit import-dsc $dscf xunk
82
83 t-git-config dgit.dsc-url-proto-ok.file true
84 t-dgit import-dsc $dscf xunk
85
86 cd ..
87
88
89 dscf=$tmp/mirror/pool/main/example_2.1.dsc
90 t-reprepro-includedsc avon $dscf ds-
91 t-reprepro-regen ds-
92
93
94 cd $p.avon
95 t-dgit fetch
96 t-ref-same refs/remotes/dgit/dgit/avon
97
98 cd ../$p.import
99 git init
100 t-dgit import-dsc $dscf +x
101 t-ref-same refs/heads/x
102 git show x | grep Spong
103
104 t-expect-fail 'Your git tree does not have that object' \
105 t-dgit --no-chase-dsc-distro import-dsc $dscf +y
106
107 cd ../$p
108 t-dgit --no-chase-dsc-distro import-dsc $dscf +y
109 git show y | grep Sid
110
111 t-ok