3 test_description='git cvsimport basic tests'
6 if ! test_have_prereq PERL; then
7 skip_all='skipping git cvsimport tests, perl not available'
11 CVSROOT=$(pwd)/cvsroot
14 test_expect_success 'setup cvsroot' '$CVS init'
16 test_expect_success 'setup a cvs module' '
18 mkdir "$CVSROOT/module" &&
19 $CVS co -d module-cvs module &&
21 cat <<EOF >o_fortuna &&
40 add "O Fortuna" lyrics
42 These public domain lyrics make an excellent sample text.
44 $CVS commit -F message &&
48 test_expect_success 'import a trivial module' '
50 git cvsimport -a -R -z 0 -C module-git module &&
51 test_cmp module-cvs/o_fortuna module-git/o_fortuna
55 test_expect_success 'pack refs' 'cd module-git && git gc && cd ..'
57 test_expect_success 'initial import has correct .git/cvs-revisions' '
60 git log --format="o_fortuna 1.1 %H" -1) > expected &&
61 test_cmp expected module-git/.git/cvs-revisions
64 test_expect_success 'update cvs module' '
67 cat <<EOF >o_fortuna &&
82 it melts them like ice.
89 $CVS commit -F message &&
93 test_expect_success 'update git module' '
96 git cvsimport -a -R -z 0 module &&
99 test_cmp module-cvs/o_fortuna module-git/o_fortuna
103 test_expect_success 'update has correct .git/cvs-revisions' '
106 git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
107 git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected &&
108 test_cmp expected module-git/.git/cvs-revisions
111 test_expect_success 'update cvs module' '
121 test_expect_success 'cvsimport.module config works' '
124 git config cvsimport.module module &&
125 git cvsimport -a -R -z0 &&
128 test_cmp module-cvs/tick module-git/tick
132 test_expect_success 'second update has correct .git/cvs-revisions' '
135 git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
136 git log --format="o_fortuna 1.2 %H" -1 HEAD^
137 git log --format="tick 1.1 %H" -1 HEAD) > expected &&
138 test_cmp expected module-git/.git/cvs-revisions
141 test_expect_success 'import from a CVS working tree' '
143 $CVS co -d import-from-wt module &&
145 git cvsimport -a -z0 &&
147 git log -1 --pretty=format:%s%n >actual &&
148 test_cmp actual expect &&
153 test_expect_success 'no .git/cvs-revisions created by default' '
155 ! test -e import-from-wt/.git/cvs-revisions
159 test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master'