]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9400-git-cvsserver-server.sh
Merge branch 'tb/pack-revindex-on-disk-cleanup'
[thirdparty/git.git] / t / t9400-git-cvsserver-server.sh
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 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
12 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13
14 . ./test-lib.sh
15
16 if ! test_have_prereq PERL; then
17 skip_all='skipping git cvsserver tests, perl not available'
18 test_done
19 fi
20 cvs >/dev/null 2>&1
21 if test $? -ne 1
22 then
23 skip_all='skipping git-cvsserver tests, cvs not found'
24 test_done
25 fi
26 perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
27 skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
28 test_done
29 }
30
31 WORKDIR=$PWD
32 SERVERDIR=$PWD/gitcvs.git
33 git_config="$SERVERDIR/config"
34 CVSROOT=":fork:$SERVERDIR"
35 CVSWORK="$PWD/cvswork"
36 CVS_SERVER=git-cvsserver
37 export CVSROOT CVS_SERVER
38
39 if perl -e 'exit(1) if not defined crypt("", "cv")'
40 then
41 PWDHASH='lac2ItudM3.KM'
42 else
43 PWDHASH='$2b$10$t8fGvE/a9eLmfOLzsZme2uOa2QtoMYwIxq9wZA6aBKtF1Yb7FJIzi'
44 fi
45
46 rm -rf "$CVSWORK" "$SERVERDIR"
47 test_expect_success 'setup' '
48 git config push.default matching &&
49 echo >empty &&
50 git add empty &&
51 git commit -q -m "First Commit" &&
52 mkdir secondroot &&
53 ( cd secondroot &&
54 git init &&
55 touch secondrootfile &&
56 git add secondrootfile &&
57 git commit -m "second root") &&
58 git fetch secondroot main &&
59 git merge --allow-unrelated-histories FETCH_HEAD &&
60 git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
61 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
62 GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" &&
63 GIT_DIR="$SERVERDIR" git config gitcvs.authdb "$SERVERDIR/auth.db" &&
64 echo "cvsuser:$PWDHASH" >"$SERVERDIR/auth.db"
65 '
66
67 # note that cvs doesn't accept absolute pathnames
68 # as argument to co -d
69 test_expect_success 'basic checkout' \
70 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork main &&
71 test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" &&
72 test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'
73
74 #------------------------
75 # PSERVER AUTHENTICATION
76 #------------------------
77
78 cat >request-anonymous <<EOF
79 BEGIN AUTH REQUEST
80 $SERVERDIR
81 anonymous
82
83 END AUTH REQUEST
84 EOF
85
86 cat >request-git <<EOF
87 BEGIN AUTH REQUEST
88 $SERVERDIR
89 git
90
91 END AUTH REQUEST
92 EOF
93
94 cat >login-anonymous <<EOF
95 BEGIN VERIFICATION REQUEST
96 $SERVERDIR
97 anonymous
98
99 END VERIFICATION REQUEST
100 EOF
101
102 cat >login-git <<EOF
103 BEGIN VERIFICATION REQUEST
104 $SERVERDIR
105 git
106
107 END VERIFICATION REQUEST
108 EOF
109
110 cat >login-git-ok <<EOF
111 BEGIN VERIFICATION REQUEST
112 $SERVERDIR
113 cvsuser
114 Ah<Z:yZZ30 e
115 END VERIFICATION REQUEST
116 EOF
117
118 test_expect_success 'pserver authentication' \
119 'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
120 sed -ne \$p log | grep "^I LOVE YOU\$"'
121
122 test_expect_success 'pserver authentication failure (non-anonymous user)' \
123 'if cat request-git | git-cvsserver pserver >log 2>&1
124 then
125 false
126 else
127 true
128 fi &&
129 sed -ne \$p log | grep "^I HATE YOU\$"'
130
131 test_expect_success 'pserver authentication success (non-anonymous user with password)' \
132 'cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
133 sed -ne \$p log | grep "^I LOVE YOU\$"'
134
135 test_expect_success 'pserver authentication (login)' \
136 'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
137 sed -ne \$p log | grep "^I LOVE YOU\$"'
138
139 test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
140 'if cat login-git | git-cvsserver pserver >log 2>&1
141 then
142 false
143 else
144 true
145 fi &&
146 sed -ne \$p log | grep "^I HATE YOU\$"'
147
148
149 # misuse pserver authentication for testing of req_Root
150
151 cat >request-relative <<EOF
152 BEGIN AUTH REQUEST
153 gitcvs.git
154 anonymous
155
156 END AUTH REQUEST
157 EOF
158
159 cat >request-conflict <<EOF
160 BEGIN AUTH REQUEST
161 $SERVERDIR
162 anonymous
163
164 END AUTH REQUEST
165 Root $WORKDIR
166 EOF
167
168 test_expect_success 'req_Root failure (relative pathname)' \
169 'if cat request-relative | git-cvsserver pserver >log 2>&1
170 then
171 echo unexpected success
172 false
173 else
174 true
175 fi &&
176 tail log | grep "^error 1 Root must be an absolute pathname$"'
177
178 test_expect_success 'req_Root failure (conflicting roots)' \
179 'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
180 tail log | grep "^error 1 Conflicting roots specified$"'
181
182 test_expect_success 'req_Root (strict paths)' \
183 'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
184 sed -ne \$p log | grep "^I LOVE YOU\$"'
185
186 test_expect_success 'req_Root failure (strict-paths)' '
187 ! cat request-anonymous |
188 git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
189 '
190
191 test_expect_success 'req_Root (w/o strict-paths)' \
192 'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
193 sed -ne \$p log | grep "^I LOVE YOU\$"'
194
195 test_expect_success 'req_Root failure (w/o strict-paths)' '
196 ! cat request-anonymous |
197 git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
198 '
199
200 cat >request-base <<EOF
201 BEGIN AUTH REQUEST
202 /gitcvs.git
203 anonymous
204
205 END AUTH REQUEST
206 Root /gitcvs.git
207 EOF
208
209 test_expect_success 'req_Root (base-path)' \
210 'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
211 sed -ne \$p log | grep "^I LOVE YOU\$"'
212
213 test_expect_success 'req_Root failure (base-path)' '
214 ! cat request-anonymous |
215 git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
216 '
217
218 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
219
220 test_expect_success 'req_Root (export-all)' \
221 'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
222 sed -ne \$p log | grep "^I LOVE YOU\$"'
223
224 test_expect_success 'req_Root failure (export-all w/o whitelist)' \
225 '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
226
227 test_expect_success 'req_Root (everything together)' \
228 'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
229 sed -ne \$p log | grep "^I LOVE YOU\$"'
230
231 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
232
233 #--------------
234 # CONFIG TESTS
235 #--------------
236
237 test_expect_success 'gitcvs.enabled = false' \
238 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
239 if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
240 then
241 echo unexpected cvs success
242 false
243 else
244 true
245 fi &&
246 grep "GITCVS emulation disabled" cvs.log &&
247 test ! -d cvswork2'
248
249 rm -fr cvswork2
250 test_expect_success 'gitcvs.ext.enabled = true' \
251 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
252 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
253 GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
254 test_cmp cvswork cvswork2'
255
256 rm -fr cvswork2
257 test_expect_success 'gitcvs.ext.enabled = false' \
258 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
259 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
260 if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
261 then
262 echo unexpected cvs success
263 false
264 else
265 true
266 fi &&
267 grep "GITCVS emulation disabled" cvs.log &&
268 test ! -d cvswork2'
269
270 rm -fr cvswork2
271 test_expect_success 'gitcvs.dbname' \
272 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
273 GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
274 GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
275 test_cmp cvswork cvswork2 &&
276 test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
277 cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"'
278
279 rm -fr cvswork2
280 test_expect_success 'gitcvs.ext.dbname' \
281 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
282 GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
283 GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
284 GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
285 test_cmp cvswork cvswork2 &&
286 test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
287 test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
288 cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"'
289
290
291 #------------
292 # CVS UPDATE
293 #------------
294
295 rm -fr "$SERVERDIR"
296 cd "$WORKDIR" &&
297 git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
298 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
299 GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
300 exit 1
301
302 test_expect_success 'cvs update (create new file)' \
303 'echo testfile1 >testfile1 &&
304 git add testfile1 &&
305 git commit -q -m "Add testfile1" &&
306 git push gitcvs.git >/dev/null &&
307 cd cvswork &&
308 GIT_CONFIG="$git_config" cvs -Q update &&
309 test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
310 test_cmp testfile1 ../testfile1'
311
312 cd "$WORKDIR"
313 test_expect_success 'cvs update (update existing file)' \
314 'echo line 2 >>testfile1 &&
315 git add testfile1 &&
316 git commit -q -m "Append to testfile1" &&
317 git push gitcvs.git >/dev/null &&
318 cd cvswork &&
319 GIT_CONFIG="$git_config" cvs -Q update &&
320 test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
321 test_cmp testfile1 ../testfile1'
322
323 cd "$WORKDIR"
324 #TODO: cvsserver doesn't support update w/o -d
325 test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
326 mkdir test &&
327 echo >test/empty &&
328 git add test &&
329 git commit -q -m "Single Subdirectory" &&
330 git push gitcvs.git >/dev/null &&
331 cd cvswork &&
332 GIT_CONFIG="$git_config" cvs -Q update &&
333 test ! -d test
334 '
335
336 cd "$WORKDIR"
337 test_expect_success 'cvs update (subdirectories)' \
338 '(for dir in A A/B A/B/C A/D E; do
339 mkdir $dir &&
340 echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" &&
341 git add $dir
342 done) &&
343 git commit -q -m "deep sub directory structure" &&
344 git push gitcvs.git >/dev/null &&
345 cd cvswork &&
346 GIT_CONFIG="$git_config" cvs -Q update -d &&
347 (for dir in A A/B A/B/C A/D E; do
348 filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
349 if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
350 test_cmp "$dir/$filename" "../$dir/$filename"; then
351 :
352 else
353 echo >failure
354 fi
355 done) &&
356 test ! -f failure'
357
358 cd "$WORKDIR"
359 test_expect_success 'cvs update (delete file)' \
360 'git rm testfile1 &&
361 git commit -q -m "Remove testfile1" &&
362 git push gitcvs.git >/dev/null &&
363 cd cvswork &&
364 GIT_CONFIG="$git_config" cvs -Q update &&
365 test -z "$(grep testfile1 CVS/Entries)" &&
366 test ! -f testfile1'
367
368 cd "$WORKDIR"
369 test_expect_success 'cvs update (re-add deleted file)' \
370 'echo readded testfile >testfile1 &&
371 git add testfile1 &&
372 git commit -q -m "Re-Add testfile1" &&
373 git push gitcvs.git >/dev/null &&
374 cd cvswork &&
375 GIT_CONFIG="$git_config" cvs -Q update &&
376 test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
377 test_cmp testfile1 ../testfile1'
378
379 cd "$WORKDIR"
380 test_expect_success 'cvs update (merge)' \
381 'echo Line 0 >expected &&
382 for i in 1 2 3 4 5 6 7
383 do
384 echo Line $i >>merge &&
385 echo Line $i >>expected
386 done &&
387 echo Line 8 >>expected &&
388 git add merge &&
389 git commit -q -m "Merge test (pre-merge)" &&
390 git push gitcvs.git >/dev/null &&
391 cd cvswork &&
392 GIT_CONFIG="$git_config" cvs -Q update &&
393 test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
394 test_cmp merge ../merge &&
395 ( echo Line 0 && cat merge ) >merge.tmp &&
396 mv merge.tmp merge &&
397 cd "$WORKDIR" &&
398 echo Line 8 >>merge &&
399 git add merge &&
400 git commit -q -m "Merge test (merge)" &&
401 git push gitcvs.git >/dev/null &&
402 cd cvswork &&
403 sleep 1 && touch merge &&
404 GIT_CONFIG="$git_config" cvs -Q update &&
405 test_cmp merge ../expected'
406
407 cd "$WORKDIR"
408
409 cat >expected.C <<EOF
410 <<<<<<< merge.mine
411 Line 0
412 =======
413 LINE 0
414 >>>>>>> merge.1.3
415 EOF
416
417 for i in 1 2 3 4 5 6 7 8
418 do
419 echo Line $i >>expected.C
420 done
421
422 test_expect_success 'cvs update (conflict merge)' \
423 '( echo LINE 0 && cat merge ) >merge.tmp &&
424 mv merge.tmp merge &&
425 git add merge &&
426 git commit -q -m "Merge test (conflict)" &&
427 git push gitcvs.git >/dev/null &&
428 cd cvswork &&
429 GIT_CONFIG="$git_config" cvs -Q update &&
430 test_cmp merge ../expected.C'
431
432 cd "$WORKDIR"
433 test_expect_success 'cvs update (-C)' \
434 'cd cvswork &&
435 GIT_CONFIG="$git_config" cvs -Q update -C &&
436 test_cmp merge ../merge'
437
438 cd "$WORKDIR"
439 test_expect_success 'cvs update (merge no-op)' \
440 'echo Line 9 >>merge &&
441 cp merge cvswork/merge &&
442 git add merge &&
443 git commit -q -m "Merge test (no-op)" &&
444 git push gitcvs.git >/dev/null &&
445 cd cvswork &&
446 sleep 1 && touch merge &&
447 GIT_CONFIG="$git_config" cvs -Q update &&
448 test_cmp merge ../merge'
449
450 cd "$WORKDIR"
451 test_expect_success 'cvs update (-p)' '
452 touch really-empty &&
453 echo Line 1 > no-lf &&
454 printf "Line 2" >> no-lf &&
455 git add really-empty no-lf &&
456 git commit -q -m "Update -p test" &&
457 git push gitcvs.git >/dev/null &&
458 cd cvswork &&
459 GIT_CONFIG="$git_config" cvs update &&
460 for i in merge no-lf empty really-empty; do
461 GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out &&
462 test_cmp $i.out ../$i || return 1
463 done
464 '
465
466 cd "$WORKDIR"
467 test_expect_success 'cvs update (module list supports packed refs)' '
468 GIT_DIR="$SERVERDIR" git pack-refs --all &&
469 GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
470 grep "cvs update: New directory \`main'\''" < out
471 '
472
473 #------------
474 # CVS STATUS
475 #------------
476
477 cd "$WORKDIR"
478 test_expect_success 'cvs status' '
479 mkdir status.dir &&
480 echo Line > status.dir/status.file &&
481 echo Line > status.file &&
482 git add status.dir status.file &&
483 git commit -q -m "Status test" &&
484 git push gitcvs.git >/dev/null &&
485 cd cvswork &&
486 GIT_CONFIG="$git_config" cvs update &&
487 GIT_CONFIG="$git_config" cvs status | grep "^File: status.file" >../out &&
488 test_line_count = 2 ../out
489 '
490
491 cd "$WORKDIR"
492 test_expect_success 'cvs status (nonrecursive)' '
493 cd cvswork &&
494 GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out &&
495 test_line_count = 1 ../out
496 '
497
498 cd "$WORKDIR"
499 test_expect_success 'cvs status (no subdirs in header)' '
500 cd cvswork &&
501 GIT_CONFIG="$git_config" cvs status | grep ^File: >../out &&
502 ! grep / <../out
503 '
504
505 #------------
506 # CVS CHECKOUT
507 #------------
508
509 cd "$WORKDIR"
510 test_expect_success 'cvs co -c (shows module database)' '
511 GIT_CONFIG="$git_config" cvs co -c > out &&
512 grep "^main[ ][ ]*main$" <out &&
513 ! grep -v "^main[ ][ ]*main$" <out
514 '
515
516 #------------
517 # CVS LOG
518 #------------
519
520 # Known issues with git-cvsserver current log output:
521 # - Hard coded "lines: +2 -3" placeholder, instead of real numbers.
522 # - CVS normally does not internally add a blank first line
523 # or a last line with nothing but a space to log messages.
524 # - The latest cvs 1.12.x server sends +0000 timezone (with some hidden "MT"
525 # tagging in the protocol), and if cvs 1.12.x client sees the MT tags,
526 # it converts to local time zone. git-cvsserver doesn't do the +0000
527 # or the MT tags...
528 # - The latest 1.12.x releases add a "commitid:" field on to the end of the
529 # "date:" line (after "lines:"). Maybe we could stick git's commit id
530 # in it? Or does CVS expect a certain number of bits (too few for
531 # a full sha1)?
532 #
533 # Given the above, expect the following test to break if git-cvsserver's
534 # log output is improved. The test is just to ensure it doesn't
535 # accidentally get worse.
536
537 sed -e 's/^x//' -e 's/SP$/ /' > "$WORKDIR/expect" <<EOF
538 x
539 xRCS file: $WORKDIR/gitcvs.git/main/merge,v
540 xWorking file: merge
541 xhead: 1.4
542 xbranch:
543 xlocks: strict
544 xaccess list:
545 xsymbolic names:
546 xkeyword substitution: kv
547 xtotal revisions: 4; selected revisions: 4
548 xdescription:
549 x----------------------------
550 xrevision 1.4
551 xdate: __DATE__; author: author; state: Exp; lines: +2 -3
552 x
553 xMerge test (no-op)
554 xSP
555 x----------------------------
556 xrevision 1.3
557 xdate: __DATE__; author: author; state: Exp; lines: +2 -3
558 x
559 xMerge test (conflict)
560 xSP
561 x----------------------------
562 xrevision 1.2
563 xdate: __DATE__; author: author; state: Exp; lines: +2 -3
564 x
565 xMerge test (merge)
566 xSP
567 x----------------------------
568 xrevision 1.1
569 xdate: __DATE__; author: author; state: Exp; lines: +2 -3
570 x
571 xMerge test (pre-merge)
572 xSP
573 x=============================================================================
574 EOF
575 expectStat="$?"
576
577 cd "$WORKDIR"
578 test_expect_success 'cvs log' '
579 cd cvswork &&
580 test x"$expectStat" = x"0" &&
581 GIT_CONFIG="$git_config" cvs log merge >../out &&
582 sed -e "s%2[0-9][0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]%__DATE__%" ../out > ../actual &&
583 test_cmp ../expect ../actual
584 '
585
586 #------------
587 # CVS ANNOTATE
588 #------------
589
590 cd "$WORKDIR"
591 test_expect_success 'cvs annotate' '
592 cd cvswork &&
593 GIT_CONFIG="$git_config" cvs annotate merge >../out &&
594 sed -e "s/ .*//" ../out >../actual &&
595 for i in 3 1 1 1 1 1 1 1 2 4; do echo 1.$i; done >../expect &&
596 test_cmp ../expect ../actual
597 '
598
599 #------------
600 # running via git-shell
601 #------------
602
603 cd "$WORKDIR"
604
605 test_expect_success 'create remote-cvs helper' '
606 write_script remote-cvs <<-\EOF
607 exec git shell -c "cvs server"
608 EOF
609 '
610
611 test_expect_success 'cvs server does not run with vanilla git-shell' '
612 (
613 cd cvswork &&
614 CVS_SERVER=$WORKDIR/remote-cvs &&
615 export CVS_SERVER &&
616 ! cvs log merge
617 )
618 '
619
620 test_expect_success 'configure git shell to run cvs server' '
621 mkdir "$HOME"/git-shell-commands &&
622
623 write_script "$HOME"/git-shell-commands/cvs <<-\EOF &&
624 if ! test $# = 1 && test "$1" = "server"
625 then
626 echo >&2 "git-cvsserver only handles \"server\""
627 exit 1
628 fi
629 exec git cvsserver server
630 EOF
631
632 # Should not be used, but part of the recommended setup
633 write_script "$HOME"/git-shell-commands/no-interactive-login <<-\EOF
634 echo Interactive login forbidden
635 EOF
636 '
637
638 test_expect_success 'cvs server can run with recommended config' '
639 (
640 cd cvswork &&
641 CVS_SERVER=$WORKDIR/remote-cvs &&
642 export CVS_SERVER &&
643 cvs log merge
644 )
645 '
646
647 test_done