Merge branch 'tr/die_errno'
[git/mjg.git] / t / t9600-cvsimport.sh
blob4322a0c1ed6d792cbba4b52a7ba8bad74986bbad
1 #!/bin/sh
3 test_description='git cvsimport basic tests'
4 . ./test-lib.sh
6 if ! test_have_prereq PERL; then
7 say 'skipping git cvsimport tests, perl not available'
8 test_done
9 fi
11 CVSROOT=$(pwd)/cvsroot
12 export CVSROOT
13 unset CVS_SERVER
14 # for clean cvsps cache
15 HOME=$(pwd)
16 export HOME
18 if ! type cvs >/dev/null 2>&1
19 then
20 say 'skipping cvsimport tests, cvs not found'
21 test_done
24 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
25 case "$cvsps_version" in
26 2.1 | 2.2*)
28 '')
29 say 'skipping cvsimport tests, cvsps not found'
30 test_done
33 say 'skipping cvsimport tests, unsupported cvsps version'
34 test_done
36 esac
38 test_expect_success 'setup cvsroot' 'cvs init'
40 test_expect_success 'setup a cvs module' '
42 mkdir "$CVSROOT/module" &&
43 cvs co -d module-cvs module &&
44 cd module-cvs &&
45 cat <<EOF >o_fortuna &&
46 O Fortuna
47 velut luna
48 statu variabilis,
50 semper crescis
51 aut decrescis;
52 vita detestabilis
54 nunc obdurat
55 et tunc curat
56 ludo mentis aciem,
58 egestatem,
59 potestatem
60 dissolvit ut glaciem.
61 EOF
62 cvs add o_fortuna &&
63 cat <<EOF >message &&
64 add "O Fortuna" lyrics
66 These public domain lyrics make an excellent sample text.
67 EOF
68 cvs commit -F message &&
69 cd ..
72 test_expect_success 'import a trivial module' '
74 git cvsimport -a -z 0 -C module-git module &&
75 test_cmp module-cvs/o_fortuna module-git/o_fortuna
79 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
81 test_expect_success 'update cvs module' '
83 cd module-cvs &&
84 cat <<EOF >o_fortuna &&
85 O Fortune,
86 like the moon
87 you are changeable,
89 ever waxing
90 and waning;
91 hateful life
93 first oppresses
94 and then soothes
95 as fancy takes it;
97 poverty
98 and power
99 it melts them like ice.
101 cat <<EOF >message &&
102 translate to English
104 My Latin is terrible.
106 cvs commit -F message &&
107 cd ..
110 test_expect_success 'update git module' '
112 cd module-git &&
113 git cvsimport -a -z 0 module &&
114 git merge origin &&
115 cd .. &&
116 test_cmp module-cvs/o_fortuna module-git/o_fortuna
120 test_expect_success 'update cvs module' '
122 cd module-cvs &&
123 echo 1 >tick &&
124 cvs add tick &&
125 cvs commit -m 1
126 cd ..
130 test_expect_success 'cvsimport.module config works' '
132 cd module-git &&
133 git config cvsimport.module module &&
134 git cvsimport -a -z0 &&
135 git merge origin &&
136 cd .. &&
137 test_cmp module-cvs/tick module-git/tick
141 test_expect_success 'import from a CVS working tree' '
143 cvs co -d import-from-wt module &&
144 cd import-from-wt &&
145 git cvsimport -a -z0 &&
146 echo 1 >expect &&
147 git log -1 --pretty=format:%s%n >actual &&
148 test_cmp actual expect &&
149 cd ..
153 test_done