3 test_description='git cvsimport basic tests'
6 test_expect_success PERL 'setup cvsroot environment' '
7 CVSROOT=$(pwd)/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 &&
18 cat <<EOF >o_fortuna &&
37 add "O Fortuna" lyrics
39 These public domain lyrics make an excellent sample text.
41 $CVS commit -F message
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)'
54 test_expect_success PERL 'initial import has correct .git/cvs-revisions' '
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 cat <<EOF >o_fortuna &&
78 it melts them like ice.
85 $CVS commit -F message
89 test_expect_success PERL 'update git module' '
92 git config cvsimport.trackRevisions true &&
93 git cvsimport -a -z 0 module &&
96 test_cmp module-cvs/o_fortuna module-git/o_fortuna
100 test_expect_success PERL 'update has correct .git/cvs-revisions' '
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' '
117 test_expect_success PERL 'cvsimport.module config works' '
120 git config cvsimport.module module &&
121 git config cvsimport.trackRevisions true &&
122 git cvsimport -a -z0 &&
125 test_cmp module-cvs/tick module-git/tick
129 test_expect_success PERL 'second update has correct .git/cvs-revisions' '
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 config cvsimport.trackRevisions false &&
143 git cvsimport -a -z0 &&
145 git log -1 --pretty=format:%s%n >actual &&
146 test_cmp actual expect
151 test_expect_success PERL 'no .git/cvs-revisions created by default' '
153 ! test -e import-from-wt/.git/cvs-revisions
157 test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'