git-p4: chdir now properly sets PWD environment variable in msysGit
[git/git-p4.git] / t / t9600-cvsimport.sh
blob0d7786a8c730d17fa194346f1da2978d23256da9
1 #!/bin/sh
3 test_description='git-cvsimport basic tests'
4 . ./test-lib.sh
6 CVSROOT=$(pwd)/cvsroot
7 export CVSROOT
8 unset CVS_SERVER
9 # for clean cvsps cache
10 HOME=$(pwd)
11 export HOME
13 if ! type cvs >/dev/null 2>&1
14 then
15 say 'skipping cvsimport tests, cvs not found'
16 test_done
17 exit
20 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
21 case "$cvsps_version" in
22 2.1 | 2.2*)
24 '')
25 say 'skipping cvsimport tests, cvsps not found'
26 test_done
27 exit
30 say 'skipping cvsimport tests, unsupported cvsps version'
31 test_done
32 exit
34 esac
36 test_expect_success 'setup cvsroot' 'cvs init'
38 test_expect_success 'setup a cvs module' '
40 mkdir "$CVSROOT/module" &&
41 cvs co -d module-cvs module &&
42 cd module-cvs &&
43 cat <<EOF >o_fortuna &&
44 O Fortuna
45 velut luna
46 statu variabilis,
48 semper crescis
49 aut decrescis;
50 vita detestabilis
52 nunc obdurat
53 et tunc curat
54 ludo mentis aciem,
56 egestatem,
57 potestatem
58 dissolvit ut glaciem.
59 EOF
60 cvs add o_fortuna &&
61 cat <<EOF >message &&
62 add "O Fortuna" lyrics
64 These public domain lyrics make an excellent sample text.
65 EOF
66 cvs commit -F message &&
67 cd ..
70 test_expect_success 'import a trivial module' '
72 git cvsimport -a -z 0 -C module-git module &&
73 test_cmp module-cvs/o_fortuna module-git/o_fortuna
77 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
79 test_expect_success 'update cvs module' '
81 cd module-cvs &&
82 cat <<EOF >o_fortuna &&
83 O Fortune,
84 like the moon
85 you are changeable,
87 ever waxing
88 and waning;
89 hateful life
91 first oppresses
92 and then soothes
93 as fancy takes it;
95 poverty
96 and power
97 it melts them like ice.
98 EOF
99 cat <<EOF >message &&
100 translate to English
102 My Latin is terrible.
104 cvs commit -F message &&
105 cd ..
108 test_expect_success 'update git module' '
110 cd module-git &&
111 git cvsimport -a -z 0 module &&
112 git merge origin &&
113 cd .. &&
114 test_cmp module-cvs/o_fortuna module-git/o_fortuna
118 test_expect_success 'update cvs module' '
120 cd module-cvs &&
121 echo 1 >tick &&
122 cvs add tick &&
123 cvs commit -m 1
124 cd ..
128 test_expect_success 'cvsimport.module config works' '
130 cd module-git &&
131 git config cvsimport.module module &&
132 git cvsimport -a -z0 &&
133 git merge origin &&
134 cd .. &&
135 test_cmp module-cvs/tick module-git/tick
139 test_expect_success 'import from a CVS working tree' '
141 cvs co -d import-from-wt module &&
142 cd import-from-wt &&
143 git cvsimport -a -z0 &&
144 echo 1 >expect &&
145 git log -1 --pretty=format:%s%n >actual &&
146 test_cmp actual expect &&
147 cd ..
151 test_done