3 test_description='git cvsimport basic tests'
6 if ! test_have_prereq NOT_ROOT; then
7 skip_all='When cvs is compiled with CVS_BADROOT commits as root fail'
11 test_expect_success PERL 'setup cvsroot environment' '
12 CVSROOT=$(pwd)/cvsroot &&
16 test_expect_success PERL 'setup cvsroot' '$CVS init'
18 test_expect_success PERL 'setup a cvs module' '
20 mkdir "$CVSROOT/module" &&
21 $CVS co -d module-cvs module &&
23 cat <<EOF >o_fortuna &&
42 add "O Fortuna" lyrics
44 These public domain lyrics make an excellent sample text.
46 $CVS commit -F message
50 test_expect_success PERL 'import a trivial module' '
52 git cvsimport -a -R -z 0 -C module-git module &&
53 test_cmp module-cvs/o_fortuna module-git/o_fortuna
57 test_expect_success PERL 'pack refs' '(cd module-git && git gc)'
59 test_expect_success PERL 'initial import has correct .git/cvs-revisions' '
62 git log --format="o_fortuna 1.1 %H" -1) > expected &&
63 test_cmp expected module-git/.git/cvs-revisions
66 test_expect_success PERL 'update cvs module' '
68 cat <<EOF >o_fortuna &&
83 it melts them like ice.
90 $CVS commit -F message
94 test_expect_success PERL 'update git module' '
97 git config cvsimport.trackRevisions true &&
98 git cvsimport -a -z 0 module &&
101 test_cmp module-cvs/o_fortuna module-git/o_fortuna
105 test_expect_success PERL 'update has correct .git/cvs-revisions' '
108 git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
109 git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected &&
110 test_cmp expected module-git/.git/cvs-revisions
113 test_expect_success PERL 'update cvs module' '
122 test_expect_success PERL 'cvsimport.module config works' '
125 git config cvsimport.module module &&
126 git config cvsimport.trackRevisions true &&
127 git cvsimport -a -z0 &&
130 test_cmp module-cvs/tick module-git/tick
134 test_expect_success PERL 'second update has correct .git/cvs-revisions' '
137 git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
138 git log --format="o_fortuna 1.2 %H" -1 HEAD^ &&
139 git log --format="tick 1.1 %H" -1 HEAD) > expected &&
140 test_cmp expected module-git/.git/cvs-revisions
143 test_expect_success PERL 'import from a CVS working tree' '
145 $CVS co -d import-from-wt module &&
146 (cd import-from-wt &&
147 git config cvsimport.trackRevisions false &&
148 git cvsimport -a -z0 &&
150 git log -1 --pretty=format:%s%n >actual &&
151 test_cmp actual expect
156 test_expect_success PERL 'no .git/cvs-revisions created by default' '
158 ! test -e import-from-wt/.git/cvs-revisions
162 test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'