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