chiark / gitweb /
3fff2712f6b17bada604920c88e2e24d003f0368
[dgit.git] / tests / tests / import-dsc
1 #!/bin/bash
2 set -e
3 . tests/lib
4 t-tstunt-parsechangelog
5
6 t-setup-import examplegit
7
8 p=example
9
10 check-import () {
11         path=$1
12         v=$2
13         opts=$3
14         branch=t.$v
15
16         dsc=${path}/${p}_${v}.dsc
17         t-dgit $opts import-dsc $dsc $branch
18
19         git checkout $branch
20
21         check-imported $dsc
22 }
23
24 check-imported () {
25         local dsc=$1
26         (
27         rm -rf ../t.unpack
28         mkdir ../t.unpack
29         cd ../t.unpack
30         dpkg-source -x $dsc
31         )
32
33         git checkout HEAD~0
34         git branch -D u.$v ||:
35         git checkout -b u.$v $branch
36         git rm -rf .
37         git clean -xdf
38         cp -al ../t.unpack/*/. .
39         git add -Af .
40
41         git diff --stat --exit-code
42 }
43
44 cd $p
45
46 check-import ../mirror/pool/main 1.2
47
48 dgit12=`git rev-parse HEAD`
49
50 dsc2=../mirror/pool/main/${p}_2.0.dsc
51
52 git checkout $branch
53 t-expect-fail 'is checked out - will not update' \
54 t-dgit import-dsc $dsc2 $branch
55
56 git checkout HEAD~0
57
58 t-expect-fail 'Not fast forward' \
59 t-dgit import-dsc $dsc2 $branch
60
61 t-expect-fail 'Not fast forward' \
62 t-dgit import-dsc $dsc2 ..$branch
63
64 t-dgit import-dsc $dsc2 +$branch
65 check-imported $dsc2
66
67 cd ..
68 mkdir $p.2
69 cd $p.2
70
71 git init
72
73 check-import $troot/pkg-srcs 1.0-1
74
75 # t-expect-fail "Your git tree does not have that object" \
76 # check-import ../mirror/pool/main 1.2
77
78 check-import ../mirror/pool/main 1.2 --force-import-dsc-with-dgit-field
79
80 v=1.0-1.100
81 dsc2=$troot/pkg-srcs/${p}_${v}.dsc
82
83 t-expect-fail E:'Branch.*already exists' \
84 t-dgit import-dsc $dsc2 $branch
85
86 git branch merge-reset
87 t-dgit import-dsc $dsc2 ..$branch
88 t-has-ancestor merge-reset $branch
89
90 git push . +merge-reset:$branch
91
92 t-dgit import-dsc $dsc2 +$branch
93
94 mb=$(t-git-merge-base merge-reset $branch)
95 test "x$mb" = x
96
97 t-expect-fail 'signature check failed' \
98 t-dgit import-dsc --require-valid-signature $dsc2 +$branch
99
100 t-ok