Code

Merge branch 'sb/doc-upstream-branch'
[git.git] / t / t9600-cvsimport.sh
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 fi
19 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
20 case "$cvsps_version" in
21 2.1 | 2.2*)
22         ;;
23 '')
24         say 'skipping cvsimport tests, cvsps not found'
25         test_done
26         ;;
27 *)
28         say 'skipping cvsimport tests, unsupported cvsps version'
29         test_done
30         ;;
31 esac
33 test_expect_success 'setup cvsroot' 'cvs init'
35 test_expect_success 'setup a cvs module' '
37         mkdir "$CVSROOT/module" &&
38         cvs co -d module-cvs module &&
39         cd module-cvs &&
40         cat <<EOF >o_fortuna &&
41 O Fortuna
42 velut luna
43 statu variabilis,
45 semper crescis
46 aut decrescis;
47 vita detestabilis
49 nunc obdurat
50 et tunc curat
51 ludo mentis aciem,
53 egestatem,
54 potestatem
55 dissolvit ut glaciem.
56 EOF
57         cvs add o_fortuna &&
58         cat <<EOF >message &&
59 add "O Fortuna" lyrics
61 These public domain lyrics make an excellent sample text.
62 EOF
63         cvs commit -F message &&
64         cd ..
65 '
67 test_expect_success 'import a trivial module' '
69         git cvsimport -a -z 0 -C module-git module &&
70         test_cmp module-cvs/o_fortuna module-git/o_fortuna
72 '
74 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
76 test_expect_success 'update cvs module' '
78         cd module-cvs &&
79         cat <<EOF >o_fortuna &&
80 O Fortune,
81 like the moon
82 you are changeable,
84 ever waxing
85 and waning;
86 hateful life
88 first oppresses
89 and then soothes
90 as fancy takes it;
92 poverty
93 and power
94 it melts them like ice.
95 EOF
96         cat <<EOF >message &&
97 translate to English
99 My Latin is terrible.
100 EOF
101         cvs commit -F message &&
102         cd ..
105 test_expect_success 'update git module' '
107         cd module-git &&
108         git cvsimport -a -z 0 module &&
109         git merge origin &&
110         cd .. &&
111         test_cmp module-cvs/o_fortuna module-git/o_fortuna
115 test_expect_success 'update cvs module' '
117         cd module-cvs &&
118                 echo 1 >tick &&
119                 cvs add tick &&
120                 cvs commit -m 1
121         cd ..
125 test_expect_success 'cvsimport.module config works' '
127         cd module-git &&
128                 git config cvsimport.module module &&
129                 git cvsimport -a -z0 &&
130                 git merge origin &&
131         cd .. &&
132         test_cmp module-cvs/tick module-git/tick
136 test_expect_success 'import from a CVS working tree' '
138         cvs co -d import-from-wt module &&
139         cd import-from-wt &&
140                 git cvsimport -a -z0 &&
141                 echo 1 >expect &&
142                 git log -1 --pretty=format:%s%n >actual &&
143                 test_cmp actual expect &&
144         cd ..
148 test_done