builtin/show: do not prune by pathspec
[git/mjg.git] / t / t9600-cvsimport.sh
blob41fcf3606b39b793cb38e41c9bdd90a4d9fe3e4b
1 #!/bin/sh
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
8 . ./lib-cvs.sh
10 if ! test_have_prereq NOT_ROOT; then
11 skip_all='When cvs is compiled with CVS_BADROOT commits as root fail'
12 test_done
15 test_expect_success PERL 'setup cvsroot environment' '
16 CVSROOT=$(pwd)/cvsroot &&
17 export 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 &&
26 (cd module-cvs &&
27 cat <<EOF >o_fortuna &&
28 O Fortuna
29 velut luna
30 statu variabilis,
32 semper crescis
33 aut decrescis;
34 vita detestabilis
36 nunc obdurat
37 et tunc curat
38 ludo mentis aciem,
40 egestatem,
41 potestatem
42 dissolvit ut glaciem.
43 EOF
44 $CVS add o_fortuna &&
45 cat <<EOF >message &&
46 add "O Fortuna" lyrics
48 These public domain lyrics make an excellent sample text.
49 EOF
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' '
65 (cd module-git &&
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' '
71 (cd module-cvs &&
72 cat <<EOF >o_fortuna &&
73 O Fortune,
74 like the moon
75 you are changeable,
77 ever waxing
78 and waning;
79 hateful life
81 first oppresses
82 and then soothes
83 as fancy takes it;
85 poverty
86 and power
87 it melts them like ice.
88 EOF
89 cat <<EOF >message &&
90 translate to English
92 My Latin is terrible.
93 EOF
94 $CVS commit -F message
98 test_expect_success PERL 'update git module' '
100 (cd module-git &&
101 git config cvsimport.trackRevisions true &&
102 git cvsimport -a -z 0 module &&
103 git merge origin
104 ) &&
105 test_cmp module-cvs/o_fortuna module-git/o_fortuna
109 test_expect_success PERL 'update has correct .git/cvs-revisions' '
111 (cd module-git &&
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' '
119 (cd module-cvs &&
120 echo 1 >tick &&
121 $CVS add tick &&
122 $CVS commit -m 1
126 test_expect_success PERL 'cvsimport.module config works' '
128 (cd module-git &&
129 git config cvsimport.module module &&
130 git config cvsimport.trackRevisions true &&
131 git cvsimport -a -z0 &&
132 git merge origin
133 ) &&
134 test_cmp module-cvs/tick module-git/tick
138 test_expect_success PERL 'second update has correct .git/cvs-revisions' '
140 (cd module-git &&
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 &&
153 echo 1 >expect &&
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'
168 test_done