]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9600-cvsimport.sh
tests: mark tests relying on the current default for `init.defaultBranch`
[thirdparty/git.git] / t / t9600-cvsimport.sh
CommitLineData
795c7c0b
JK
1#!/bin/sh
2
f964732c 3test_description='git cvsimport basic tests'
334afbc7
JS
4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
535bb893 7. ./lib-cvs.sh
795c7c0b 8
a78d9258
ÆAB
9if ! test_have_prereq NOT_ROOT; then
10 skip_all='When cvs is compiled with CVS_BADROOT commits as root fail'
11 test_done
12fi
13
900eab44
ÆAB
14test_expect_success PERL 'setup cvsroot environment' '
15 CVSROOT=$(pwd)/cvsroot &&
16 export CVSROOT
17'
dcbcb707 18
900eab44 19test_expect_success PERL 'setup cvsroot' '$CVS init'
795c7c0b 20
900eab44 21test_expect_success PERL 'setup a cvs module' '
795c7c0b 22
f69e836f 23 mkdir "$CVSROOT/module" &&
161261b1 24 $CVS co -d module-cvs module &&
fd4ec4f2 25 (cd module-cvs &&
795c7c0b
JK
26 cat <<EOF >o_fortuna &&
27O Fortuna
28velut luna
29statu variabilis,
30
31semper crescis
32aut decrescis;
33vita detestabilis
34
35nunc obdurat
36et tunc curat
37ludo mentis aciem,
38
39egestatem,
40potestatem
41dissolvit ut glaciem.
42EOF
161261b1 43 $CVS add o_fortuna &&
795c7c0b
JK
44 cat <<EOF >message &&
45add "O Fortuna" lyrics
46
47These public domain lyrics make an excellent sample text.
48EOF
fd4ec4f2
JL
49 $CVS commit -F message
50 )
795c7c0b
JK
51'
52
900eab44 53test_expect_success PERL 'import a trivial module' '
795c7c0b 54
0455ec03 55 git cvsimport -a -R -z 0 -C module-git module &&
3af82863 56 test_cmp module-cvs/o_fortuna module-git/o_fortuna
795c7c0b
JK
57
58'
59
347c47e6 60test_expect_success PERL 'pack refs' '(cd module-git && git gc)'
9da0dabc 61
900eab44 62test_expect_success PERL 'initial import has correct .git/cvs-revisions' '
0455ec03
AC
63
64 (cd module-git &&
65 git log --format="o_fortuna 1.1 %H" -1) > expected &&
66 test_cmp expected module-git/.git/cvs-revisions
67'
68
900eab44 69test_expect_success PERL 'update cvs module' '
fd4ec4f2 70 (cd module-cvs &&
795c7c0b
JK
71 cat <<EOF >o_fortuna &&
72O Fortune,
73like the moon
74you are changeable,
75
76ever waxing
77and waning;
78hateful life
79
80first oppresses
81and then soothes
82as fancy takes it;
83
84poverty
85and power
86it melts them like ice.
87EOF
88 cat <<EOF >message &&
89translate to English
90
91My Latin is terrible.
92EOF
fd4ec4f2
JL
93 $CVS commit -F message
94 )
795c7c0b
JK
95'
96
900eab44 97test_expect_success PERL 'update git module' '
795c7c0b 98
fd4ec4f2 99 (cd module-git &&
60d5985d
MG
100 git config cvsimport.trackRevisions true &&
101 git cvsimport -a -z 0 module &&
fd4ec4f2
JL
102 git merge origin
103 ) &&
3af82863 104 test_cmp module-cvs/o_fortuna module-git/o_fortuna
795c7c0b
JK
105
106'
107
900eab44 108test_expect_success PERL 'update has correct .git/cvs-revisions' '
0455ec03
AC
109
110 (cd module-git &&
111 git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
112 git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected &&
113 test_cmp expected module-git/.git/cvs-revisions
114'
115
900eab44 116test_expect_success PERL 'update cvs module' '
67d23242 117
fd4ec4f2 118 (cd module-cvs &&
67d23242 119 echo 1 >tick &&
161261b1
MH
120 $CVS add tick &&
121 $CVS commit -m 1
fd4ec4f2 122 )
67d23242
JK
123'
124
900eab44 125test_expect_success PERL 'cvsimport.module config works' '
67d23242 126
fd4ec4f2 127 (cd module-git &&
67d23242 128 git config cvsimport.module module &&
60d5985d
MG
129 git config cvsimport.trackRevisions true &&
130 git cvsimport -a -z0 &&
fd4ec4f2
JL
131 git merge origin
132 ) &&
3af82863 133 test_cmp module-cvs/tick module-git/tick
67d23242
JK
134
135'
136
900eab44 137test_expect_success PERL 'second update has correct .git/cvs-revisions' '
0455ec03
AC
138
139 (cd module-git &&
140 git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
cff4243d 141 git log --format="o_fortuna 1.2 %H" -1 HEAD^ &&
0455ec03
AC
142 git log --format="tick 1.1 %H" -1 HEAD) > expected &&
143 test_cmp expected module-git/.git/cvs-revisions
144'
145
900eab44 146test_expect_success PERL 'import from a CVS working tree' '
4e596e98 147
161261b1 148 $CVS co -d import-from-wt module &&
fd4ec4f2 149 (cd import-from-wt &&
60d5985d 150 git config cvsimport.trackRevisions false &&
4e596e98
JK
151 git cvsimport -a -z0 &&
152 echo 1 >expect &&
153 git log -1 --pretty=format:%s%n >actual &&
dcbaa0b3 154 test_cmp expect actual
fd4ec4f2 155 )
4e596e98
JK
156
157'
158
900eab44 159test_expect_success PERL 'no .git/cvs-revisions created by default' '
0455ec03
AC
160
161 ! test -e import-from-wt/.git/cvs-revisions
162
163'
164
900eab44 165test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'
cefa318d 166
795c7c0b 167test_done