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