t4200: use cut instead of sed
[git/peff.git] / t / t9600-cvsimport.sh
blob7706430d81e62e70d7124234e89b54fc65caa7d5
1 #!/bin/sh
3 test_description='git-cvsimport basic tests'
4 . ./test-lib.sh
6 if ! type cvs >/dev/null 2>&1
7 then
8 say 'skipping cvsimport tests, cvs not found'
9 test_done
10 exit
13 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
14 case "$cvsps_version" in
15 2.1)
17 '')
18 say 'skipping cvsimport tests, cvsps not found'
19 test_done
20 exit
23 say 'skipping cvsimport tests, cvsps too old'
24 test_done
25 exit
27 esac
29 CVSROOT=$(pwd)/cvsroot
30 export CVSROOT
31 # for clean cvsps cache
32 HOME=$(pwd)
33 export HOME
35 test_expect_success 'setup cvsroot' 'cvs init'
37 test_expect_success 'setup a cvs module' '
39 mkdir $CVSROOT/module &&
40 cvs co -d module-cvs module &&
41 cd module-cvs &&
42 cat <<EOF >o_fortuna &&
43 O Fortuna
44 velut luna
45 statu variabilis,
47 semper crescis
48 aut decrescis;
49 vita detestabilis
51 nunc obdurat
52 et tunc curat
53 ludo mentis aciem,
55 egestatem,
56 potestatem
57 dissolvit ut glaciem.
58 EOF
59 cvs add o_fortuna &&
60 cat <<EOF >message &&
61 add "O Fortuna" lyrics
63 These public domain lyrics make an excellent sample text.
64 EOF
65 cvs commit -F message &&
66 cd ..
69 test_expect_success 'import a trivial module' '
71 git cvsimport -a -z 0 -C module-git module &&
72 git diff module-cvs/o_fortuna module-git/o_fortuna
76 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
78 test_expect_success 'update cvs module' '
80 cd module-cvs &&
81 cat <<EOF >o_fortuna &&
82 O Fortune,
83 like the moon
84 you are changeable,
86 ever waxing
87 and waning;
88 hateful life
90 first oppresses
91 and then soothes
92 as fancy takes it;
94 poverty
95 and power
96 it melts them like ice.
97 EOF
98 cat <<EOF >message &&
99 translate to English
101 My Latin is terrible.
103 cvs commit -F message &&
104 cd ..
107 test_expect_success 'update git module' '
109 cd module-git &&
110 git cvsimport -a -z 0 module &&
111 git merge origin &&
112 cd .. &&
113 git diff module-cvs/o_fortuna module-git/o_fortuna
117 test_expect_success 'update cvs module' '
119 cd module-cvs &&
120 echo 1 >tick &&
121 cvs add tick &&
122 cvs commit -m 1
123 cd ..
127 test_expect_success 'cvsimport.module config works' '
129 cd module-git &&
130 git config cvsimport.module module &&
131 git cvsimport -a -z0 &&
132 git merge origin &&
133 cd .. &&
134 git diff module-cvs/tick module-git/tick
138 test_expect_success 'import from a CVS working tree' '
140 cvs co -d import-from-wt module &&
141 cd import-from-wt &&
142 git cvsimport -a -z0 &&
143 echo 1 >expect &&
144 git log -1 --pretty=format:%s%n >actual &&
145 git diff actual expect &&
146 cd ..
150 test_done