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