Commit | Line | Data |
---|---|---|
b3b53439 FL |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Frank Lichtenheld | |
4 | # | |
5 | ||
6 | test_description='git-cvsserver access | |
7 | ||
8 | tests read access to a git repository with the | |
9 | cvs CLI client via git-cvsserver server' | |
10 | ||
11 | . ./test-lib.sh | |
12 | ||
1b19ccd2 | 13 | if ! test_have_prereq PERL; then |
fadb5156 | 14 | skip_all='skipping git cvsserver tests, perl not available' |
1b19ccd2 JK |
15 | test_done |
16 | fi | |
b3b53439 FL |
17 | cvs >/dev/null 2>&1 |
18 | if test $? -ne 1 | |
19 | then | |
fadb5156 | 20 | skip_all='skipping git-cvsserver tests, cvs not found' |
b3b53439 | 21 | test_done |
b3b53439 | 22 | fi |
be38ca3d | 23 | "$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { |
fadb5156 | 24 | skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable' |
469be5b2 | 25 | test_done |
469be5b2 | 26 | } |
b3b53439 FL |
27 | |
28 | unset GIT_DIR GIT_CONFIG | |
29 | WORKDIR=$(pwd) | |
30 | SERVERDIR=$(pwd)/gitcvs.git | |
a25907da | 31 | git_config="$SERVERDIR/config" |
b3b53439 | 32 | CVSROOT=":fork:$SERVERDIR" |
a25907da | 33 | CVSWORK="$(pwd)/cvswork" |
b3b53439 FL |
34 | CVS_SERVER=git-cvsserver |
35 | export CVSROOT CVS_SERVER | |
36 | ||
37 | rm -rf "$CVSWORK" "$SERVERDIR" | |
75493765 SP |
38 | test_expect_success 'setup' ' |
39 | echo >empty && | |
b3b53439 FL |
40 | git add empty && |
41 | git commit -q -m "First Commit" && | |
e509db99 SP |
42 | mkdir secondroot && |
43 | ( cd secondroot && | |
44 | git init && | |
45 | touch secondrootfile && | |
46 | git add secondrootfile && | |
47 | git commit -m "second root") && | |
48 | git pull secondroot master && | |
7fd3ef1f | 49 | git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && |
b3b53439 | 50 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && |
1dd3f291 ÆAB |
51 | GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" && |
52 | GIT_DIR="$SERVERDIR" git config gitcvs.authdb "$SERVERDIR/auth.db" && | |
53 | echo cvsuser:cvGVEarMLnhlA > "$SERVERDIR/auth.db" | |
75493765 | 54 | ' |
b3b53439 FL |
55 | |
56 | # note that cvs doesn't accept absolute pathnames | |
57 | # as argument to co -d | |
58 | test_expect_success 'basic checkout' \ | |
a25907da | 59 | 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master && |
e509db99 | 60 | test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" |
b4ce54fc | 61 | test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"' |
b3b53439 | 62 | |
240ba7f2 FL |
63 | #------------------------ |
64 | # PSERVER AUTHENTICATION | |
65 | #------------------------ | |
66 | ||
67 | cat >request-anonymous <<EOF | |
68 | BEGIN AUTH REQUEST | |
69 | $SERVERDIR | |
70 | anonymous | |
71 | ||
72 | END AUTH REQUEST | |
73 | EOF | |
74 | ||
75 | cat >request-git <<EOF | |
76 | BEGIN AUTH REQUEST | |
77 | $SERVERDIR | |
78 | git | |
79 | ||
80 | END AUTH REQUEST | |
81 | EOF | |
82 | ||
24a97d84 FL |
83 | cat >login-anonymous <<EOF |
84 | BEGIN VERIFICATION REQUEST | |
85 | $SERVERDIR | |
86 | anonymous | |
87 | ||
88 | END VERIFICATION REQUEST | |
89 | EOF | |
90 | ||
91 | cat >login-git <<EOF | |
92 | BEGIN VERIFICATION REQUEST | |
93 | $SERVERDIR | |
94 | git | |
95 | ||
96 | END VERIFICATION REQUEST | |
97 | EOF | |
98 | ||
1dd3f291 ÆAB |
99 | cat >login-git-ok <<EOF |
100 | BEGIN VERIFICATION REQUEST | |
101 | $SERVERDIR | |
102 | cvsuser | |
103 | Ah<Z:yZZ30 e | |
104 | END VERIFICATION REQUEST | |
105 | EOF | |
106 | ||
240ba7f2 FL |
107 | test_expect_success 'pserver authentication' \ |
108 | 'cat request-anonymous | git-cvsserver pserver >log 2>&1 && | |
9524cf29 | 109 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
240ba7f2 FL |
110 | |
111 | test_expect_success 'pserver authentication failure (non-anonymous user)' \ | |
112 | 'if cat request-git | git-cvsserver pserver >log 2>&1 | |
113 | then | |
114 | false | |
115 | else | |
116 | true | |
117 | fi && | |
9524cf29 | 118 | sed -ne \$p log | grep "^I HATE YOU\$"' |
240ba7f2 | 119 | |
1dd3f291 ÆAB |
120 | test_expect_success 'pserver authentication success (non-anonymous user with password)' \ |
121 | 'cat login-git-ok | git-cvsserver pserver >log 2>&1 && | |
122 | sed -ne \$p log | grep "^I LOVE YOU\$"' | |
123 | ||
24a97d84 FL |
124 | test_expect_success 'pserver authentication (login)' \ |
125 | 'cat login-anonymous | git-cvsserver pserver >log 2>&1 && | |
9524cf29 | 126 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
24a97d84 FL |
127 | |
128 | test_expect_success 'pserver authentication failure (login/non-anonymous user)' \ | |
129 | 'if cat login-git | git-cvsserver pserver >log 2>&1 | |
130 | then | |
131 | false | |
132 | else | |
133 | true | |
134 | fi && | |
9524cf29 | 135 | sed -ne \$p log | grep "^I HATE YOU\$"' |
24a97d84 | 136 | |
240ba7f2 | 137 | |
4890888d FL |
138 | # misuse pserver authentication for testing of req_Root |
139 | ||
140 | cat >request-relative <<EOF | |
141 | BEGIN AUTH REQUEST | |
142 | gitcvs.git | |
143 | anonymous | |
144 | ||
145 | END AUTH REQUEST | |
146 | EOF | |
147 | ||
148 | cat >request-conflict <<EOF | |
149 | BEGIN AUTH REQUEST | |
150 | $SERVERDIR | |
151 | anonymous | |
152 | ||
153 | END AUTH REQUEST | |
154 | Root $WORKDIR | |
155 | EOF | |
156 | ||
157 | test_expect_success 'req_Root failure (relative pathname)' \ | |
158 | 'if cat request-relative | git-cvsserver pserver >log 2>&1 | |
159 | then | |
160 | echo unexpected success | |
161 | false | |
162 | else | |
163 | true | |
164 | fi && | |
aadbe44f | 165 | tail log | grep "^error 1 Root must be an absolute pathname$"' |
4890888d FL |
166 | |
167 | test_expect_success 'req_Root failure (conflicting roots)' \ | |
168 | 'cat request-conflict | git-cvsserver pserver >log 2>&1 && | |
aadbe44f | 169 | tail log | grep "^error 1 Conflicting roots specified$"' |
4890888d | 170 | |
693b6327 | 171 | test_expect_success 'req_Root (strict paths)' \ |
f69e836f | 172 | 'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 && |
9524cf29 | 173 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
693b6327 | 174 | |
41ac414e JH |
175 | test_expect_success 'req_Root failure (strict-paths)' ' |
176 | ! cat request-anonymous | | |
f69e836f | 177 | git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1 |
41ac414e | 178 | ' |
693b6327 FL |
179 | |
180 | test_expect_success 'req_Root (w/o strict-paths)' \ | |
f69e836f | 181 | 'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 && |
9524cf29 | 182 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
693b6327 | 183 | |
41ac414e JH |
184 | test_expect_success 'req_Root failure (w/o strict-paths)' ' |
185 | ! cat request-anonymous | | |
f69e836f | 186 | git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1 |
41ac414e | 187 | ' |
693b6327 FL |
188 | |
189 | cat >request-base <<EOF | |
190 | BEGIN AUTH REQUEST | |
191 | /gitcvs.git | |
192 | anonymous | |
193 | ||
194 | END AUTH REQUEST | |
fd1cd91e | 195 | Root /gitcvs.git |
693b6327 FL |
196 | EOF |
197 | ||
198 | test_expect_success 'req_Root (base-path)' \ | |
f69e836f | 199 | 'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 && |
9524cf29 | 200 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
693b6327 | 201 | |
41ac414e JH |
202 | test_expect_success 'req_Root failure (base-path)' ' |
203 | ! cat request-anonymous | | |
f69e836f | 204 | git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1 |
41ac414e | 205 | ' |
4890888d | 206 | |
226bccb9 FL |
207 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1 |
208 | ||
209 | test_expect_success 'req_Root (export-all)' \ | |
f69e836f | 210 | 'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 && |
9524cf29 | 211 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
226bccb9 | 212 | |
41ac414e JH |
213 | test_expect_success 'req_Root failure (export-all w/o whitelist)' \ |
214 | '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)' | |
226bccb9 FL |
215 | |
216 | test_expect_success 'req_Root (everything together)' \ | |
f69e836f | 217 | 'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 && |
9524cf29 | 218 | sed -ne \$p log | grep "^I LOVE YOU\$"' |
226bccb9 FL |
219 | |
220 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1 | |
221 | ||
1d431b22 FL |
222 | #-------------- |
223 | # CONFIG TESTS | |
224 | #-------------- | |
225 | ||
226 | test_expect_success 'gitcvs.enabled = false' \ | |
227 | 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && | |
228 | if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 | |
229 | then | |
230 | echo unexpected cvs success | |
231 | false | |
232 | else | |
233 | true | |
234 | fi && | |
aadbe44f | 235 | grep "GITCVS emulation disabled" cvs.log && |
1d431b22 FL |
236 | test ! -d cvswork2' |
237 | ||
238 | rm -fr cvswork2 | |
239 | test_expect_success 'gitcvs.ext.enabled = true' \ | |
240 | 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && | |
241 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && | |
242 | GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && | |
4a2284b9 | 243 | test_cmp cvswork cvswork2' |
1d431b22 FL |
244 | |
245 | rm -fr cvswork2 | |
246 | test_expect_success 'gitcvs.ext.enabled = false' \ | |
247 | 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false && | |
248 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && | |
249 | if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 | |
250 | then | |
251 | echo unexpected cvs success | |
252 | false | |
253 | else | |
254 | true | |
255 | fi && | |
aadbe44f | 256 | grep "GITCVS emulation disabled" cvs.log && |
1d431b22 FL |
257 | test ! -d cvswork2' |
258 | ||
259 | rm -fr cvswork2 | |
260 | test_expect_success 'gitcvs.dbname' \ | |
261 | 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && | |
262 | GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite && | |
263 | GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && | |
4a2284b9 | 264 | test_cmp cvswork cvswork2 && |
1d431b22 FL |
265 | test -f "$SERVERDIR/gitcvs.ext.master.sqlite" && |
266 | cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"' | |
267 | ||
268 | rm -fr cvswork2 | |
269 | test_expect_success 'gitcvs.ext.dbname' \ | |
270 | 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && | |
271 | GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && | |
272 | GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && | |
273 | GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && | |
4a2284b9 | 274 | test_cmp cvswork cvswork2 && |
1d431b22 FL |
275 | test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" && |
276 | test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" && | |
277 | cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"' | |
278 | ||
279 | ||
280 | #------------ | |
281 | # CVS UPDATE | |
282 | #------------ | |
283 | ||
284 | rm -fr "$SERVERDIR" | |
285 | cd "$WORKDIR" && | |
7fd3ef1f | 286 | git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && |
1d431b22 | 287 | GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && |
db1696b8 | 288 | GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" || |
1d431b22 FL |
289 | exit 1 |
290 | ||
b3b53439 FL |
291 | test_expect_success 'cvs update (create new file)' \ |
292 | 'echo testfile1 >testfile1 && | |
293 | git add testfile1 && | |
294 | git commit -q -m "Add testfile1" && | |
295 | git push gitcvs.git >/dev/null && | |
296 | cd cvswork && | |
a25907da | 297 | GIT_CONFIG="$git_config" cvs -Q update && |
b3b53439 | 298 | test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" && |
4a2284b9 | 299 | test_cmp testfile1 ../testfile1' |
b3b53439 FL |
300 | |
301 | cd "$WORKDIR" | |
302 | test_expect_success 'cvs update (update existing file)' \ | |
303 | 'echo line 2 >>testfile1 && | |
304 | git add testfile1 && | |
305 | git commit -q -m "Append to testfile1" && | |
306 | git push gitcvs.git >/dev/null && | |
307 | cd cvswork && | |
a25907da | 308 | GIT_CONFIG="$git_config" cvs -Q update && |
b3b53439 | 309 | test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" && |
4a2284b9 | 310 | test_cmp testfile1 ../testfile1' |
b3b53439 FL |
311 | |
312 | cd "$WORKDIR" | |
313 | #TODO: cvsserver doesn't support update w/o -d | |
41ac414e JH |
314 | test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" ' |
315 | mkdir test && | |
b3b53439 FL |
316 | echo >test/empty && |
317 | git add test && | |
318 | git commit -q -m "Single Subdirectory" && | |
319 | git push gitcvs.git >/dev/null && | |
320 | cd cvswork && | |
a25907da | 321 | GIT_CONFIG="$git_config" cvs -Q update && |
41ac414e JH |
322 | test ! -d test |
323 | ' | |
b3b53439 FL |
324 | |
325 | cd "$WORKDIR" | |
326 | test_expect_success 'cvs update (subdirectories)' \ | |
327 | '(for dir in A A/B A/B/C A/D E; do | |
328 | mkdir $dir && | |
329 | echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" && | |
330 | git add $dir; | |
331 | done) && | |
332 | git commit -q -m "deep sub directory structure" && | |
333 | git push gitcvs.git >/dev/null && | |
334 | cd cvswork && | |
a25907da | 335 | GIT_CONFIG="$git_config" cvs -Q update -d && |
b3b53439 FL |
336 | (for dir in A A/B A/B/C A/D E; do |
337 | filename="file_in_$(echo $dir|sed -e "s#/# #g")" && | |
338 | if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" && | |
4a2284b9 | 339 | test_cmp "$dir/$filename" "../$dir/$filename"; then |
b3b53439 FL |
340 | : |
341 | else | |
342 | echo >failure | |
343 | fi | |
344 | done) && | |
345 | test ! -f failure' | |
346 | ||
347 | cd "$WORKDIR" | |
348 | test_expect_success 'cvs update (delete file)' \ | |
349 | 'git rm testfile1 && | |
350 | git commit -q -m "Remove testfile1" && | |
351 | git push gitcvs.git >/dev/null && | |
352 | cd cvswork && | |
a25907da | 353 | GIT_CONFIG="$git_config" cvs -Q update && |
b3b53439 FL |
354 | test -z "$(grep testfile1 CVS/Entries)" && |
355 | test ! -f testfile1' | |
356 | ||
357 | cd "$WORKDIR" | |
358 | test_expect_success 'cvs update (re-add deleted file)' \ | |
359 | 'echo readded testfile >testfile1 && | |
360 | git add testfile1 && | |
361 | git commit -q -m "Re-Add testfile1" && | |
362 | git push gitcvs.git >/dev/null && | |
363 | cd cvswork && | |
a25907da | 364 | GIT_CONFIG="$git_config" cvs -Q update && |
b3b53439 | 365 | test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" && |
4a2284b9 | 366 | test_cmp testfile1 ../testfile1' |
b3b53439 | 367 | |
1978659a FL |
368 | cd "$WORKDIR" |
369 | test_expect_success 'cvs update (merge)' \ | |
370 | 'echo Line 0 >expected && | |
371 | for i in 1 2 3 4 5 6 7 | |
372 | do | |
373 | echo Line $i >>merge | |
374 | echo Line $i >>expected | |
375 | done && | |
376 | echo Line 8 >>expected && | |
377 | git add merge && | |
378 | git commit -q -m "Merge test (pre-merge)" && | |
379 | git push gitcvs.git >/dev/null && | |
380 | cd cvswork && | |
381 | GIT_CONFIG="$git_config" cvs -Q update && | |
382 | test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" && | |
4a2284b9 | 383 | test_cmp merge ../merge && |
1978659a FL |
384 | ( echo Line 0; cat merge ) >merge.tmp && |
385 | mv merge.tmp merge && | |
386 | cd "$WORKDIR" && | |
387 | echo Line 8 >>merge && | |
388 | git add merge && | |
389 | git commit -q -m "Merge test (merge)" && | |
390 | git push gitcvs.git >/dev/null && | |
391 | cd cvswork && | |
b3c81cff | 392 | sleep 1 && touch merge && |
1978659a | 393 | GIT_CONFIG="$git_config" cvs -Q update && |
4a2284b9 | 394 | test_cmp merge ../expected' |
1978659a FL |
395 | |
396 | cd "$WORKDIR" | |
397 | ||
398 | cat >expected.C <<EOF | |
399 | <<<<<<< merge.mine | |
400 | Line 0 | |
401 | ======= | |
402 | LINE 0 | |
403 | >>>>>>> merge.3 | |
404 | EOF | |
405 | ||
406 | for i in 1 2 3 4 5 6 7 8 | |
407 | do | |
408 | echo Line $i >>expected.C | |
409 | done | |
410 | ||
411 | test_expect_success 'cvs update (conflict merge)' \ | |
412 | '( echo LINE 0; cat merge ) >merge.tmp && | |
413 | mv merge.tmp merge && | |
414 | git add merge && | |
415 | git commit -q -m "Merge test (conflict)" && | |
416 | git push gitcvs.git >/dev/null && | |
417 | cd cvswork && | |
418 | GIT_CONFIG="$git_config" cvs -Q update && | |
4a2284b9 | 419 | test_cmp merge ../expected.C' |
1978659a FL |
420 | |
421 | cd "$WORKDIR" | |
422 | test_expect_success 'cvs update (-C)' \ | |
423 | 'cd cvswork && | |
424 | GIT_CONFIG="$git_config" cvs -Q update -C && | |
4a2284b9 | 425 | test_cmp merge ../merge' |
1978659a FL |
426 | |
427 | cd "$WORKDIR" | |
428 | test_expect_success 'cvs update (merge no-op)' \ | |
429 | 'echo Line 9 >>merge && | |
430 | cp merge cvswork/merge && | |
431 | git add merge && | |
432 | git commit -q -m "Merge test (no-op)" && | |
433 | git push gitcvs.git >/dev/null && | |
434 | cd cvswork && | |
b3c81cff | 435 | sleep 1 && touch merge && |
1978659a | 436 | GIT_CONFIG="$git_config" cvs -Q update && |
4a2284b9 | 437 | test_cmp merge ../merge' |
1978659a | 438 | |
6e8937a0 DD |
439 | cd "$WORKDIR" |
440 | test_expect_success 'cvs update (-p)' ' | |
441 | touch really-empty && | |
442 | echo Line 1 > no-lf && | |
6ecfd91d | 443 | printf "Line 2" >> no-lf && |
6e8937a0 DD |
444 | git add really-empty no-lf && |
445 | git commit -q -m "Update -p test" && | |
446 | git push gitcvs.git >/dev/null && | |
447 | cd cvswork && | |
448 | GIT_CONFIG="$git_config" cvs update && | |
449 | rm -f failures && | |
450 | for i in merge no-lf empty really-empty; do | |
451 | GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out | |
4fdf71be | 452 | test_cmp $i.out ../$i >>failures 2>&1 |
6e8937a0 DD |
453 | done && |
454 | test -z "$(cat failures)" | |
455 | ' | |
456 | ||
b0f2ecf5 LN |
457 | cd "$WORKDIR" |
458 | test_expect_success 'cvs update (module list supports packed refs)' ' | |
459 | GIT_DIR="$SERVERDIR" git pack-refs --all && | |
460 | GIT_CONFIG="$git_config" cvs -n up -d 2> out && | |
461 | grep "cvs update: New directory \`master'\''" < out | |
462 | ' | |
463 | ||
dded801a DD |
464 | #------------ |
465 | # CVS STATUS | |
466 | #------------ | |
467 | ||
468 | cd "$WORKDIR" | |
469 | test_expect_success 'cvs status' ' | |
470 | mkdir status.dir && | |
471 | echo Line > status.dir/status.file && | |
472 | echo Line > status.file && | |
473 | git add status.dir status.file && | |
474 | git commit -q -m "Status test" && | |
475 | git push gitcvs.git >/dev/null && | |
476 | cd cvswork && | |
477 | GIT_CONFIG="$git_config" cvs update && | |
478 | GIT_CONFIG="$git_config" cvs status | grep "^File: status.file" >../out && | |
479 | test $(wc -l <../out) = 2 | |
480 | ' | |
481 | ||
482 | cd "$WORKDIR" | |
483 | test_expect_success 'cvs status (nonrecursive)' ' | |
484 | cd cvswork && | |
485 | GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out && | |
486 | test $(wc -l <../out) = 1 | |
487 | ' | |
488 | ||
489 | cd "$WORKDIR" | |
490 | test_expect_success 'cvs status (no subdirs in header)' ' | |
491 | cd cvswork && | |
492 | GIT_CONFIG="$git_config" cvs status | grep ^File: >../out && | |
493 | ! grep / <../out | |
494 | ' | |
495 | ||
42f7a2da FE |
496 | #------------ |
497 | # CVS CHECKOUT | |
498 | #------------ | |
499 | ||
500 | cd "$WORKDIR" | |
501 | test_expect_success 'cvs co -c (shows module database)' ' | |
502 | GIT_CONFIG="$git_config" cvs co -c > out && | |
503 | grep "^master[ ]\+master$" < out && | |
504 | ! grep -v "^master[ ]\+master$" < out | |
505 | ' | |
506 | ||
7ceacdff JH |
507 | #------------ |
508 | # CVS ANNOTATE | |
509 | #------------ | |
510 | ||
511 | cd "$WORKDIR" | |
512 | test_expect_success 'cvs annotate' ' | |
513 | cd cvswork && | |
514 | GIT_CONFIG="$git_config" cvs annotate merge >../out && | |
515 | sed -e "s/ .*//" ../out >../actual && | |
516 | for i in 3 1 1 1 1 1 1 1 2 4; do echo 1.$i; done >../expect && | |
517 | test_cmp ../expect ../actual | |
518 | ' | |
519 | ||
b3b53439 | 520 | test_done |