]>
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 JK |
6 | if ! test_have_prereq PERL; then |
7 | say 'skipping git cvsimport tests, perl not available' | |
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 | ||
50 | git cvsimport -a -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 | ||
795c7c0b JK |
57 | test_expect_success 'update cvs module' ' |
58 | ||
59 | cd module-cvs && | |
60 | cat <<EOF >o_fortuna && | |
61 | O Fortune, | |
62 | like the moon | |
63 | you are changeable, | |
64 | ||
65 | ever waxing | |
66 | and waning; | |
67 | hateful life | |
68 | ||
69 | first oppresses | |
70 | and then soothes | |
71 | as fancy takes it; | |
72 | ||
73 | poverty | |
74 | and power | |
75 | it melts them like ice. | |
76 | EOF | |
77 | cat <<EOF >message && | |
78 | translate to English | |
79 | ||
80 | My Latin is terrible. | |
81 | EOF | |
161261b1 | 82 | $CVS commit -F message && |
795c7c0b JK |
83 | cd .. |
84 | ' | |
85 | ||
86 | test_expect_success 'update git module' ' | |
87 | ||
88 | cd module-git && | |
89 | git cvsimport -a -z 0 module && | |
90 | git merge origin && | |
91 | cd .. && | |
3af82863 | 92 | test_cmp module-cvs/o_fortuna module-git/o_fortuna |
795c7c0b JK |
93 | |
94 | ' | |
95 | ||
67d23242 JK |
96 | test_expect_success 'update cvs module' ' |
97 | ||
98 | cd module-cvs && | |
99 | echo 1 >tick && | |
161261b1 MH |
100 | $CVS add tick && |
101 | $CVS commit -m 1 | |
67d23242 JK |
102 | cd .. |
103 | ||
104 | ' | |
105 | ||
106 | test_expect_success 'cvsimport.module config works' ' | |
107 | ||
108 | cd module-git && | |
109 | git config cvsimport.module module && | |
110 | git cvsimport -a -z0 && | |
111 | git merge origin && | |
112 | cd .. && | |
3af82863 | 113 | test_cmp module-cvs/tick module-git/tick |
67d23242 JK |
114 | |
115 | ' | |
116 | ||
4e596e98 JK |
117 | test_expect_success 'import from a CVS working tree' ' |
118 | ||
161261b1 | 119 | $CVS co -d import-from-wt module && |
4e596e98 JK |
120 | cd import-from-wt && |
121 | git cvsimport -a -z0 && | |
122 | echo 1 >expect && | |
123 | git log -1 --pretty=format:%s%n >actual && | |
3af82863 | 124 | test_cmp actual expect && |
4e596e98 JK |
125 | cd .. |
126 | ||
127 | ' | |
128 | ||
cefa318d MH |
129 | test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master' |
130 | ||
795c7c0b | 131 | test_done |