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