Code

t9600: test cvsimport from CVS working tree
[git.git] / t / t9600-cvsimport.sh
1 #!/bin/sh
3 test_description='git-cvsimport basic tests'
4 . ./test-lib.sh
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
13 CVSROOT=$(pwd)/cvsroot
14 export CVSROOT
15 # for clean cvsps cache
16 HOME=$(pwd)
17 export HOME
19 test_expect_success 'setup cvsroot' 'cvs init'
21 test_expect_success 'setup a cvs module' '
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,
31 semper crescis
32 aut decrescis;
33 vita detestabilis
35 nunc obdurat
36 et tunc curat
37 ludo mentis aciem,
39 egestatem,
40 potestatem
41 dissolvit ut glaciem.
42 EOF
43         cvs add o_fortuna &&
44         cat <<EOF >message &&
45 add "O Fortuna" lyrics
47 These public domain lyrics make an excellent sample text.
48 EOF
49         cvs commit -F message &&
50         cd ..
51 '
53 test_expect_success 'import a trivial module' '
55         git cvsimport -a -z 0 -C module-git module &&
56         git diff module-cvs/o_fortuna module-git/o_fortuna
58 '
60 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
62 test_expect_success 'update cvs module' '
64         cd module-cvs &&
65         cat <<EOF >o_fortuna &&
66 O Fortune,
67 like the moon
68 you are changeable,
70 ever waxing
71 and waning;
72 hateful life
74 first oppresses
75 and then soothes
76 as fancy takes it;
78 poverty
79 and power
80 it melts them like ice.
81 EOF
82         cat <<EOF >message &&
83 translate to English
85 My Latin is terrible.
86 EOF
87         cvs commit -F message &&
88         cd ..
89 '
91 test_expect_success 'update git module' '
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
99 '
101 test_expect_success 'update cvs module' '
103         cd module-cvs &&
104                 echo 1 >tick &&
105                 cvs add tick &&
106                 cvs commit -m 1
107         cd ..
111 test_expect_success 'cvsimport.module config works' '
113         cd module-git &&
114                 git config cvsimport.module module &&
115                 git cvsimport -a -z0 &&
116                 git merge origin &&
117         cd .. &&
118         git diff module-cvs/tick module-git/tick
122 test_expect_success 'import from a CVS working tree' '
124         cvs co -d import-from-wt module &&
125         cd import-from-wt &&
126                 git cvsimport -a -z0 &&
127                 echo 1 >expect &&
128                 git log -1 --pretty=format:%s%n >actual &&
129                 git diff actual expect &&
130         cd ..
134 test_done