Git 1.7.3 rc1
[git/dscho.git] / t / t9600-cvsimport.sh
blob559ce417954e1ef8276efc860ca63eb0bdcce284
1 #!/bin/sh
3 test_description='git cvsimport basic tests'
4 . ./lib-cvs.sh
6 test_expect_success PERL 'setup cvsroot environment' '
7 CVSROOT=$(pwd)/cvsroot &&
8 export CVSROOT
11 test_expect_success PERL 'setup cvsroot' '$CVS init'
13 test_expect_success PERL 'setup a cvs module' '
15 mkdir "$CVSROOT/module" &&
16 $CVS co -d module-cvs module &&
17 cd module-cvs &&
18 cat <<EOF >o_fortuna &&
19 O Fortuna
20 velut luna
21 statu variabilis,
23 semper crescis
24 aut decrescis;
25 vita detestabilis
27 nunc obdurat
28 et tunc curat
29 ludo mentis aciem,
31 egestatem,
32 potestatem
33 dissolvit ut glaciem.
34 EOF
35 $CVS add o_fortuna &&
36 cat <<EOF >message &&
37 add "O Fortuna" lyrics
39 These public domain lyrics make an excellent sample text.
40 EOF
41 $CVS commit -F message &&
42 cd ..
45 test_expect_success PERL 'import a trivial module' '
47 git cvsimport -a -R -z 0 -C module-git module &&
48 test_cmp module-cvs/o_fortuna module-git/o_fortuna
52 test_expect_success PERL 'pack refs' 'cd module-git && git gc && cd ..'
54 test_expect_success PERL 'initial import has correct .git/cvs-revisions' '
56 (cd module-git &&
57 git log --format="o_fortuna 1.1 %H" -1) > expected &&
58 test_cmp expected module-git/.git/cvs-revisions
61 test_expect_success PERL 'update cvs module' '
63 cd module-cvs &&
64 cat <<EOF >o_fortuna &&
65 O Fortune,
66 like the moon
67 you are changeable,
69 ever waxing
70 and waning;
71 hateful life
73 first oppresses
74 and then soothes
75 as fancy takes it;
77 poverty
78 and power
79 it melts them like ice.
80 EOF
81 cat <<EOF >message &&
82 translate to English
84 My Latin is terrible.
85 EOF
86 $CVS commit -F message &&
87 cd ..
90 test_expect_success PERL 'update git module' '
92 cd module-git &&
93 git cvsimport -a -R -z 0 module &&
94 git merge origin &&
95 cd .. &&
96 test_cmp module-cvs/o_fortuna module-git/o_fortuna
100 test_expect_success PERL 'update has correct .git/cvs-revisions' '
102 (cd module-git &&
103 git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
104 git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected &&
105 test_cmp expected module-git/.git/cvs-revisions
108 test_expect_success PERL 'update cvs module' '
110 cd module-cvs &&
111 echo 1 >tick &&
112 $CVS add tick &&
113 $CVS commit -m 1
114 cd ..
118 test_expect_success PERL 'cvsimport.module config works' '
120 cd module-git &&
121 git config cvsimport.module module &&
122 git cvsimport -a -R -z0 &&
123 git merge origin &&
124 cd .. &&
125 test_cmp module-cvs/tick module-git/tick
129 test_expect_success PERL 'second update has correct .git/cvs-revisions' '
131 (cd module-git &&
132 git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
133 git log --format="o_fortuna 1.2 %H" -1 HEAD^
134 git log --format="tick 1.1 %H" -1 HEAD) > expected &&
135 test_cmp expected module-git/.git/cvs-revisions
138 test_expect_success PERL '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 test_cmp actual expect &&
146 cd ..
150 test_expect_success PERL 'no .git/cvs-revisions created by default' '
152 ! test -e import-from-wt/.git/cvs-revisions
156 test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'
158 test_done