chiark / gitweb /
dgit: clone-dgit-repos-server: Set $access_forpush
[dgit.git] / tests / tests / protocol-compat
1 #!/bin/bash
2 set -e
3 . tests/lib
4 . $troot/lib-reprepro
5
6 t-setup-import examplegit
7 t-tstunt-parsechangelog
8
9 prep () {
10         dscf=$tmp/mirror/pool/main/example_$v.dsc
11 }
12
13 check () {
14         pd=$p.$suite
15         t-refs-same-start
16
17         t-archive-none $p
18         t-archive-query $suite
19
20         t-dgit clone $p $suite $pd
21         cd $pd
22         t-ref-head
23
24         $1
25
26         t-dgit import-dsc $dscf +imported
27         t-ref-same refs/heads/imported
28         cd ..
29 }
30
31 reset () {
32         cd ..
33         rm -rf $pd
34         mkdir $pd
35         cd $pd
36         git init
37 }
38
39 : ---------- newer ----------
40
41 suite=sid
42 v=2.1
43 prep
44
45 perl -i~ -pe 's/^Dgit: .*/$& EXTRA DATA\n TO BE IGNORED/' $dscf
46
47 check reset
48
49 : ---------- newline ----------
50
51 suite=testing
52 v=2.0
53 prep
54
55 perl -i~ -pe 's/^(Dgit: \w+ \S+ \S+) (.*)/$1\n $2 EXTRA/' $dscf
56
57 check reset
58
59 : ---------- older ----------
60
61 suite=stable
62 v=1.2
63 prep
64
65 perl -i -pe 's/^(Dgit: \w+).*/$1/' $dscf
66
67 t-git-config dgit.default.old-dsc-distro test-dummy
68
69 check
70
71 : ---------- expect fail ----------
72
73 pd=$p.fail
74
75 t-git-config dgit.default.old-dsc-distro downstream
76
77 t-expect-fail 'no configured url and .dsc provides no hint' \
78 t-dgit clone $p $suite $pd
79
80
81 t-ok