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