3 test_description
='git cvsimport basic tests'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_PASSES_SANITIZE_LEAK
=true
10 if ! test_have_prereq NOT_ROOT
; then
11 skip_all
='When cvs is compiled with CVS_BADROOT commits as root fail'
15 test_expect_success PERL
'setup cvsroot environment' '
16 CVSROOT=$(pwd)/cvsroot &&
20 test_expect_success PERL
'setup cvsroot' '$CVS init'
22 test_expect_success PERL
'setup a cvs module' '
24 mkdir "$CVSROOT/module" &&
25 $CVS co -d module-cvs module &&
27 cat <<EOF >o_fortuna &&
46 add "O Fortuna" lyrics
48 These public domain lyrics make an excellent sample text.
50 $CVS commit -F message
54 test_expect_success PERL
'import a trivial module' '
56 git cvsimport -a -R -z 0 -C module-git module &&
57 test_cmp module-cvs/o_fortuna module-git/o_fortuna
61 test_expect_success PERL
'pack refs' '(cd module-git && git gc)'
63 test_expect_success PERL
'initial import has correct .git/cvs-revisions' '
66 git log --format="o_fortuna 1.1 %H" -1) > expected &&
67 test_cmp expected module-git/.git/cvs-revisions
70 test_expect_success PERL
'update cvs module' '
72 cat <<EOF >o_fortuna &&
87 it melts them like ice.
94 $CVS commit -F message
98 test_expect_success PERL
'update git module' '
101 git config cvsimport.trackRevisions true &&
102 git cvsimport -a -z 0 module &&
105 test_cmp module-cvs/o_fortuna module-git/o_fortuna
109 test_expect_success PERL
'update has correct .git/cvs-revisions' '
112 git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
113 git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected &&
114 test_cmp expected module-git/.git/cvs-revisions
117 test_expect_success PERL
'update cvs module' '
126 test_expect_success PERL
'cvsimport.module config works' '
129 git config cvsimport.module module &&
130 git config cvsimport.trackRevisions true &&
131 git cvsimport -a -z0 &&
134 test_cmp module-cvs/tick module-git/tick
138 test_expect_success PERL
'second update has correct .git/cvs-revisions' '
141 git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
142 git log --format="o_fortuna 1.2 %H" -1 HEAD^ &&
143 git log --format="tick 1.1 %H" -1 HEAD) > expected &&
144 test_cmp expected module-git/.git/cvs-revisions
147 test_expect_success PERL
'import from a CVS working tree' '
149 $CVS co -d import-from-wt module &&
150 (cd import-from-wt &&
151 git config cvsimport.trackRevisions false &&
152 git cvsimport -a -z0 &&
154 git log -1 --pretty=format:%s%n >actual &&
155 test_cmp expect actual
160 test_expect_success PERL
'no .git/cvs-revisions created by default' '
162 ! test -e import-from-wt/.git/cvs-revisions
166 test_expect_success PERL
'test entire HEAD' 'test_cmp_branch_tree main'