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