Merge branch 'jk/maint-cvsimport-fix' into maint
[git] / t / t9600-cvsimport.sh
1 #!/bin/sh
2
3 test_description='git-cvsimport basic tests'
4 . ./test-lib.sh
5
6 if ! ( type cvs && type cvsps ) >/dev/null 2>&1
7 then
8         test_expect_success 'skipping cvsimport tests, cvs/cvsps not found' ''
9         test_done
10         exit
11 fi
12
13 CVSROOT=$(pwd)/cvsroot
14 export CVSROOT
15 # for clean cvsps cache
16 HOME=$(pwd)
17 export HOME
18
19 test_expect_success 'setup cvsroot' 'cvs init'
20
21 test_expect_success 'setup a cvs module' '
22
23         mkdir $CVSROOT/module &&
24         cvs co -d module-cvs module &&
25         cd module-cvs &&
26         cat <<EOF >o_fortuna &&
27 O Fortuna
28 velut luna
29 statu variabilis,
30
31 semper crescis
32 aut decrescis;
33 vita detestabilis
34
35 nunc obdurat
36 et tunc curat
37 ludo mentis aciem,
38
39 egestatem,
40 potestatem
41 dissolvit ut glaciem.
42 EOF
43         cvs add o_fortuna &&
44         cat <<EOF >message &&
45 add "O Fortuna" lyrics
46
47 These public domain lyrics make an excellent sample text.
48 EOF
49         cvs commit -F message &&
50         cd ..
51 '
52
53 test_expect_success 'import a trivial module' '
54
55         git cvsimport -a -z 0 -C module-git module &&
56         git diff module-cvs/o_fortuna module-git/o_fortuna
57
58 '
59
60 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
61
62 test_expect_success 'update cvs module' '
63
64         cd module-cvs &&
65         cat <<EOF >o_fortuna &&
66 O Fortune,
67 like the moon
68 you are changeable,
69
70 ever waxing
71 and waning;
72 hateful life
73
74 first oppresses
75 and then soothes
76 as fancy takes it;
77
78 poverty
79 and power
80 it melts them like ice.
81 EOF
82         cat <<EOF >message &&
83 translate to English
84
85 My Latin is terrible.
86 EOF
87         cvs commit -F message &&
88         cd ..
89 '
90
91 test_expect_success 'update git module' '
92
93         cd module-git &&
94         git cvsimport -a -z 0 module &&
95         git merge origin &&
96         cd .. &&
97         git diff module-cvs/o_fortuna module-git/o_fortuna
98
99 '
100
101 test_done