cvsserver: add t9402 to test branch and tag refs
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthew Ogilvie committed
Oct 13, 2012 at 23:42 UTC
aa7aab3b0b4e001f10c5c7d8f721aaff8753cd88
1 file changed
+558
t/t9402-git-cvsserver-refs.sh
new
+558
@@ -0,0 +1,558 @@
1
+#!/bin/sh
2
+
3
+test_description='git-cvsserver and git refspecs
4
+
5
+tests ability for git-cvsserver to switch between and compare
6
+tags, branches and other git refspecs'
7
+
8
+. ./test-lib.sh
9
+
10
+#########
11
+
12
+check_start_tree() {
13
+ rm -f "$WORKDIR/check.list"
14
+ echo "start $1" >> "${WORKDIR}/check.log"
15
+}
16
+
17
+check_file() {
18
+ sandbox="$1"
19
+ file="$2"
20
+ ver="$3"
21
+ GIT_DIR=$SERVERDIR git show "${ver}:${file}" \
22
+ > "$WORKDIR/check.got" 2> "$WORKDIR/check.stderr"
23
+ test_cmp "$WORKDIR/check.got" "$sandbox/$file"
24
+ stat=$?
25
+ echo "check_file $sandbox $file $ver : $stat" >> "$WORKDIR/check.log"
26
+ echo "$file" >> "$WORKDIR/check.list"
27
+ return $stat
28
+}
29
+
30
+check_end_tree() {
31
+ sandbox="$1"
32
+ expectCount=$(wc -l < "$WORKDIR/check.list")
33
+ cvsCount=$(find "$sandbox" -name CVS -prune -o -type f -print | wc -l)
34
+ test x"$cvsCount" = x"$expectCount"
35
+ stat=$?
36
+ echo "check_end $sandbox : $stat cvs=$cvsCount expect=$expectCount" \
37
+ >> "$WORKDIR/check.log"
38
+ return $stat
39
+}
40
+
41
+check_end_full_tree() {
42
+ sandbox="$1"
43
+ ver="$2"
44
+ expectCount=$(wc -l < "$WORKDIR/check.list")
45
+ cvsCount=$(find "$sandbox" -name CVS -prune -o -type f -print | wc -l)
46
+ gitCount=$(git ls-tree -r "$2" | wc -l)
47
+ test x"$cvsCount" = x"$expectCount" -a x"$gitCount" = x"$expectCount"
48
+ stat=$?
49
+ echo "check_end $sandbox : $stat cvs=$cvsCount git=$gitCount expect=$expectCount" \
50
+ >> "$WORKDIR/check.log"
51
+ return $stat
52
+}
53
+
54
+#########
55
+
56
+check_diff() {
57
+ diffFile="$1"
58
+ vOld="$2"
59
+ vNew="$3"
60
+ rm -rf diffSandbox
61
+ git clone -q -n . diffSandbox &&
62
+ ( cd diffSandbox &&
63
+ git checkout "$vOld" &&
64
+ git apply -p0 --index <"../$diffFile" &&
65
+ git diff --exit-code "$vNew" ) > check_diff_apply.out 2>&1
66
+}
67
+
68
+#########
69
+
70
+cvs >/dev/null 2>&1
71
+if test $? -ne 1
72
+then
73
+ skip_all='skipping git-cvsserver tests, cvs not found'
74
+ test_done
75
+fi
76
+if ! test_have_prereq PERL
77
+then
78
+ skip_all='skipping git-cvsserver tests, perl not available'
79
+ test_done
80
+fi
81
+"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
82
+ skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
83
+ test_done
84
+}
85
+
86
+unset GIT_DIR GIT_CONFIG
87
+WORKDIR=$(pwd)
88
+SERVERDIR=$(pwd)/gitcvs.git
89
+git_config="$SERVERDIR/config"
90
+CVSROOT=":fork:$SERVERDIR"
91
+CVSWORK="$(pwd)/cvswork"
92
+CVS_SERVER=git-cvsserver
93
+export CVSROOT CVS_SERVER
94
+
95
+rm -rf "$CVSWORK" "$SERVERDIR"
96
+test_expect_success 'setup v1, b1' '
97
+ echo "Simple text file" > textfile.c &&
98
+ echo "t2" > t2 &&
99
+ mkdir adir &&
100
+ echo "adir/afile line1" > adir/afile &&
101
+ echo "adir/afile line2" >> adir/afile &&
102
+ echo "adir/afile line3" >> adir/afile &&
103
+ echo "adir/afile line4" >> adir/afile &&
104
+ echo "adir/a2file" >> adir/a2file &&
105
+ mkdir adir/bdir &&
106
+ echo "adir/bdir/bfile line 1" > adir/bdir/bfile &&
107
+ echo "adir/bdir/bfile line 2" >> adir/bdir/bfile &&
108
+ echo "adir/bdir/b2file" > adir/bdir/b2file &&
109
+ git add textfile.c t2 adir &&
110
+ git commit -q -m "First Commit (v1)" &&
111
+ git tag v1 &&
112
+ git branch b1 &&
113
+ git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
114
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
115
+ GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log"
116
+'
117
+
118
+rm -rf cvswork
119
+test_expect_success 'cvs co v1' '
120
+ cvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&
121
+ check_start_tree cvswork &&
122
+ check_file cvswork textfile.c v1 &&
123
+ check_file cvswork t2 v1 &&
124
+ check_file cvswork adir/afile v1 &&
125
+ check_file cvswork adir/a2file v1 &&
126
+ check_file cvswork adir/bdir/bfile v1 &&
127
+ check_file cvswork adir/bdir/b2file v1 &&
128
+ check_end_tree cvswork
129
+'
130
+
131
+rm -rf cvswork
132
+test_expect_success 'cvs co b1' '
133
+ cvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&
134
+ check_start_tree cvswork &&
135
+ check_file cvswork textfile.c v1 &&
136
+ check_file cvswork t2 v1 &&
137
+ check_file cvswork adir/afile v1 &&
138
+ check_file cvswork adir/a2file v1 &&
139
+ check_file cvswork adir/bdir/bfile v1 &&
140
+ check_file cvswork adir/bdir/b2file v1 &&
141
+ check_end_tree cvswork
142
+'
143
+
144
+test_expect_success 'cvs co b1 [cvswork3]' '
145
+ cvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&
146
+ check_start_tree cvswork3 &&
147
+ check_file cvswork3 textfile.c v1 &&
148
+ check_file cvswork3 t2 v1 &&
149
+ check_file cvswork3 adir/afile v1 &&
150
+ check_file cvswork3 adir/a2file v1 &&
151
+ check_file cvswork3 adir/bdir/bfile v1 &&
152
+ check_file cvswork3 adir/bdir/b2file v1 &&
153
+ check_end_full_tree cvswork3 v1
154
+'
155
+
156
+test_expect_success 'edit cvswork3 and save diff' '
157
+ ( cd cvswork3 &&
158
+ sed -i -e "s/line1/line1 - data/" adir/afile &&
159
+ echo "afile5" > adir/afile5 &&
160
+ rm t2 &&
161
+ cvs -f add adir/afile5 &&
162
+ cvs -f rm t2 &&
163
+ test_must_fail cvs -f diff -N -u >"$WORKDIR/cvswork3edit.diff"
164
+ )
165
+'
166
+
167
+test_expect_success 'setup v1.2 on b1' '
168
+ git checkout b1 &&
169
+ echo "new v1.2" > t3 &&
170
+ rm t2 &&
171
+ sed -i -e "s/line3/line3 - more data/" adir/afile &&
172
+ rm adir/a2file &&
173
+ echo "a3file" >> adir/a3file &&
174
+ echo "bfile line 3" >> adir/bdir/bfile &&
175
+ rm adir/bdir/b2file &&
176
+ echo "b3file" > adir/bdir/b3file &&
177
+ mkdir cdir &&
178
+ echo "cdir/cfile" > cdir/cfile &&
179
+ git add -A cdir adir t3 t2 &&
180
+ git commit -q -m 'v1.2' &&
181
+ git tag v1.2 &&
182
+ git push --tags gitcvs.git b1:b1
183
+'
184
+
185
+test_expect_success 'cvs -f up (on b1 adir)' '
186
+ ( cd cvswork/adir &&
187
+ cvs -f up -d ) >cvs.log 2>&1 &&
188
+ check_start_tree cvswork &&
189
+ check_file cvswork textfile.c v1 &&
190
+ check_file cvswork t2 v1 &&
191
+ check_file cvswork adir/afile v1.2 &&
192
+ check_file cvswork adir/a3file v1.2 &&
193
+ check_file cvswork adir/bdir/bfile v1.2 &&
194
+ check_file cvswork adir/bdir/b3file v1.2 &&
195
+ check_end_tree cvswork
196
+'
197
+
198
+test_expect_success 'cvs up (on b1 /)' '
199
+ ( cd cvswork &&
200
+ cvs -f up -d ) >cvs.log 2>&1 &&
201
+ check_start_tree cvswork &&
202
+ check_file cvswork textfile.c v1.2 &&
203
+ check_file cvswork t3 v1.2 &&
204
+ check_file cvswork adir/afile v1.2 &&
205
+ check_file cvswork adir/a3file v1.2 &&
206
+ check_file cvswork adir/bdir/bfile v1.2 &&
207
+ check_file cvswork adir/bdir/b3file v1.2 &&
208
+ check_file cvswork cdir/cfile v1.2 &&
209
+ check_end_tree cvswork
210
+'
211
+
212
+# Make sure "CVS/Tag" files didn't get messed up:
213
+test_expect_success 'cvs up (on b1 /) (again; check CVS/Tag files)' '
214
+ ( cd cvswork &&
215
+ cvs -f up -d ) >cvs.log 2>&1 &&
216
+ check_start_tree cvswork &&
217
+ check_file cvswork textfile.c v1.2 &&
218
+ check_file cvswork t3 v1.2 &&
219
+ check_file cvswork adir/afile v1.2 &&
220
+ check_file cvswork adir/a3file v1.2 &&
221
+ check_file cvswork adir/bdir/bfile v1.2 &&
222
+ check_file cvswork adir/bdir/b3file v1.2 &&
223
+ check_file cvswork cdir/cfile v1.2 &&
224
+ check_end_tree cvswork
225
+'
226
+
227
+# update to another version:
228
+test_expect_success 'cvs up -r v1' '
229
+ ( cd cvswork &&
230
+ cvs -f up -r v1 ) >cvs.log 2>&1 &&
231
+ check_start_tree cvswork &&
232
+ check_file cvswork textfile.c v1 &&
233
+ check_file cvswork t2 v1 &&
234
+ check_file cvswork adir/afile v1 &&
235
+ check_file cvswork adir/a2file v1 &&
236
+ check_file cvswork adir/bdir/bfile v1 &&
237
+ check_file cvswork adir/bdir/b2file v1 &&
238
+ check_end_tree cvswork
239
+'
240
+
241
+test_expect_success 'cvs up' '
242
+ ( cd cvswork &&
243
+ cvs -f up ) >cvs.log 2>&1 &&
244
+ check_start_tree cvswork &&
245
+ check_file cvswork textfile.c v1 &&
246
+ check_file cvswork t2 v1 &&
247
+ check_file cvswork adir/afile v1 &&
248
+ check_file cvswork adir/a2file v1 &&
249
+ check_file cvswork adir/bdir/bfile v1 &&
250
+ check_file cvswork adir/bdir/b2file v1 &&
251
+ check_end_tree cvswork
252
+'
253
+
254
+test_expect_success 'cvs up (again; check CVS/Tag files)' '
255
+ ( cd cvswork &&
256
+ cvs -f up -d ) >cvs.log 2>&1 &&
257
+ check_start_tree cvswork &&
258
+ check_file cvswork textfile.c v1 &&
259
+ check_file cvswork t2 v1 &&
260
+ check_file cvswork adir/afile v1 &&
261
+ check_file cvswork adir/a2file v1 &&
262
+ check_file cvswork adir/bdir/bfile v1 &&
263
+ check_file cvswork adir/bdir/b2file v1 &&
264
+ check_end_tree cvswork
265
+'
266
+
267
+test_expect_success 'setup simple b2' '
268
+ git branch b2 v1 &&
269
+ git push --tags gitcvs.git b2:b2
270
+'
271
+
272
+test_expect_success 'cvs co b2 [into cvswork2]' '
273
+ cvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&
274
+ check_start_tree cvswork &&
275
+ check_file cvswork textfile.c v1 &&
276
+ check_file cvswork t2 v1 &&
277
+ check_file cvswork adir/afile v1 &&
278
+ check_file cvswork adir/a2file v1 &&
279
+ check_file cvswork adir/bdir/bfile v1 &&
280
+ check_file cvswork adir/bdir/b2file v1 &&
281
+ check_end_tree cvswork
282
+'
283
+
284
+test_expect_success 'root dir edit [cvswork2]' '
285
+ ( cd cvswork2 &&
286
+ echo "Line 2" >> textfile.c &&
287
+ test_must_fail cvs -f diff -u >"$WORKDIR/cvsEdit1.diff" &&
288
+ cvs -f commit -m "edit textfile.c" textfile.c
289
+ ) >cvsEdit1.log 2>&1
290
+'
291
+
292
+test_expect_success 'root dir rm file [cvswork2]' '
293
+ ( cd cvswork2 &&
294
+ cvs -f rm -f t2 &&
295
+ cvs -f diff -u > ../cvsEdit2-empty.diff &&
296
+ test_must_fail cvs -f diff -N -u >"$WORKDIR/cvsEdit2-N.diff" &&
297
+ cvs -f commit -m "rm t2"
298
+ ) > cvsEdit2.log 2>&1
299
+'
300
+
301
+test_expect_success 'subdir edit/add/rm files [cvswork2' '
302
+ ( cd cvswork2 &&
303
+ sed -i -e "s/line 1/line 1 (v2)/" adir/bdir/bfile &&
304
+ rm adir/bdir/b2file &&
305
+ cd adir &&
306
+ cvs -f rm bdir/b2file &&
307
+ echo "4th file" > bdir/b4file &&
308
+ cvs -f add bdir/b4file &&
309
+ test_must_fail cvs -f diff -N -u >"$WORKDIR/cvsEdit3.diff" &&
310
+ git fetch gitcvs.git b2:b2 &&
311
+ ( cd .. &&
312
+ test_must_fail cvs -f diff -u -N -r v1.2 >"$WORKDIR/cvsEdit3-v1.2.diff" &&
313
+ test_must_fail cvs -f diff -u -N -r v1.2 -r v1 >"$WORKDIR/cvsEdit3-v1.2-v1.diff"
314
+ ) &&
315
+ cvs -f commit -m "various add/rm/edit"
316
+ ) >cvs.log 2>&1
317
+'
318
+
319
+test_expect_success 'validate result of edits [cvswork2]' '
320
+ git fetch gitcvs.git b2:b2 &&
321
+ git tag v2 b2 &&
322
+ git push --tags gitcvs.git b2:b2 &&
323
+ check_start_tree cvswork2 &&
324
+ check_file cvswork2 textfile.c v2 &&
325
+ check_file cvswork2 adir/afile v2 &&
326
+ check_file cvswork2 adir/a2file v2 &&
327
+ check_file cvswork2 adir/bdir/bfile v2 &&
328
+ check_file cvswork2 adir/bdir/b4file v2 &&
329
+ check_end_full_tree cvswork2 v2
330
+'
331
+
332
+test_expect_success 'validate basic diffs saved during above cvswork2 edits' '
333
+ test $(grep Index: cvsEdit1.diff | wc -l) = 1 &&
334
+ test ! -s cvsEdit2-empty.diff &&
335
+ test $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&
336
+ test $(grep Index: cvsEdit3.diff | wc -l) = 3 &&
337
+ rm -rf diffSandbox &&
338
+ git clone -q -n . diffSandbox &&
339
+ ( cd diffSandbox &&
340
+ git checkout v1 &&
341
+ git apply -p0 --index <"$WORKDIR/cvsEdit1.diff" &&
342
+ git apply -p0 --index <"$WORKDIR/cvsEdit2-N.diff" &&
343
+ git apply -p0 --directory=adir --index <"$WORKDIR/cvsEdit3.diff" &&
344
+ git diff --exit-code v2 ) >"check_diff_apply.out" 2>&1
345
+'
346
+
347
+test_expect_success 'validate v1.2 diff saved during last cvswork2 edit' '
348
+ test $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&
349
+ check_diff cvsEdit3-v1.2.diff v1.2 v2
350
+'
351
+
352
+test_expect_success 'validate v1.2 v1 diff saved during last cvswork2 edit' '
353
+ test $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&
354
+ check_diff cvsEdit3-v1.2-v1.diff v1.2 v1
355
+'
356
+
357
+test_expect_success 'cvs up [cvswork2]' '
358
+ ( cd cvswork2 &&
359
+ cvs -f up ) >cvs.log 2>&1 &&
360
+ check_start_tree cvswork2 &&
361
+ check_file cvswork2 textfile.c v2 &&
362
+ check_file cvswork2 adir/afile v2 &&
363
+ check_file cvswork2 adir/a2file v2 &&
364
+ check_file cvswork2 adir/bdir/bfile v2 &&
365
+ check_file cvswork2 adir/bdir/b4file v2 &&
366
+ check_end_full_tree cvswork2 v2
367
+'
368
+
369
+test_expect_success 'cvs up -r b2 [back to cvswork]' '
370
+ ( cd cvswork &&
371
+ cvs -f up -r b2 ) >cvs.log 2>&1 &&
372
+ check_start_tree cvswork &&
373
+ check_file cvswork textfile.c v2 &&
374
+ check_file cvswork adir/afile v2 &&
375
+ check_file cvswork adir/a2file v2 &&
376
+ check_file cvswork adir/bdir/bfile v2 &&
377
+ check_file cvswork adir/bdir/b4file v2 &&
378
+ check_end_full_tree cvswork v2
379
+'
380
+
381
+test_expect_success 'cvs up -r b1' '
382
+ ( cd cvswork &&
383
+ cvs -f up -r b1 ) >cvs.log 2>&1 &&
384
+ check_start_tree cvswork &&
385
+ check_file cvswork textfile.c v1.2 &&
386
+ check_file cvswork t3 v1.2 &&
387
+ check_file cvswork adir/afile v1.2 &&
388
+ check_file cvswork adir/a3file v1.2 &&
389
+ check_file cvswork adir/bdir/bfile v1.2 &&
390
+ check_file cvswork adir/bdir/b3file v1.2 &&
391
+ check_file cvswork cdir/cfile v1.2 &&
392
+ check_end_full_tree cvswork v1.2
393
+'
394
+
395
+test_expect_success 'cvs up -A' '
396
+ ( cd cvswork &&
397
+ cvs -f up -A ) >cvs.log 2>&1 &&
398
+ check_start_tree cvswork &&
399
+ check_file cvswork textfile.c v1 &&
400
+ check_file cvswork t2 v1 &&
401
+ check_file cvswork adir/afile v1 &&
402
+ check_file cvswork adir/a2file v1 &&
403
+ check_file cvswork adir/bdir/bfile v1 &&
404
+ check_file cvswork adir/bdir/b2file v1 &&
405
+ check_end_full_tree cvswork v1
406
+'
407
+
408
+test_expect_success 'cvs up (check CVS/Tag files)' '
409
+ ( cd cvswork &&
410
+ cvs -f up ) >cvs.log 2>&1 &&
411
+ check_start_tree cvswork &&
412
+ check_file cvswork textfile.c v1 &&
413
+ check_file cvswork t2 v1 &&
414
+ check_file cvswork adir/afile v1 &&
415
+ check_file cvswork adir/a2file v1 &&
416
+ check_file cvswork adir/bdir/bfile v1 &&
417
+ check_file cvswork adir/bdir/b2file v1 &&
418
+ check_end_full_tree cvswork v1
419
+'
420
+
421
+# This is not really legal CVS, but it seems to work anyway:
422
+test_expect_success 'cvs up -r heads/b1' '
423
+ ( cd cvswork &&
424
+ cvs -f up -r heads/b1 ) >cvs.log 2>&1 &&
425
+ check_start_tree cvswork &&
426
+ check_file cvswork textfile.c v1.2 &&
427
+ check_file cvswork t3 v1.2 &&
428
+ check_file cvswork adir/afile v1.2 &&
429
+ check_file cvswork adir/a3file v1.2 &&
430
+ check_file cvswork adir/bdir/bfile v1.2 &&
431
+ check_file cvswork adir/bdir/b3file v1.2 &&
432
+ check_file cvswork cdir/cfile v1.2 &&
433
+ check_end_full_tree cvswork v1.2
434
+'
435
+
436
+# But this should work even if CVS client checks -r more carefully:
437
+test_expect_success 'cvs up -r heads_-s-b2 (cvsserver escape mechanism)' '
438
+ ( cd cvswork &&
439
+ cvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&
440
+ check_start_tree cvswork &&
441
+ check_file cvswork textfile.c v2 &&
442
+ check_file cvswork adir/afile v2 &&
443
+ check_file cvswork adir/a2file v2 &&
444
+ check_file cvswork adir/bdir/bfile v2 &&
445
+ check_file cvswork adir/bdir/b4file v2 &&
446
+ check_end_full_tree cvswork v2
447
+'
448
+
449
+v1hash=$(git rev-parse v1)
450
+test_expect_success 'cvs up -r $(git rev-parse v1)' '
451
+ test -n "$v1hash" &&
452
+ ( cd cvswork &&
453
+ cvs -f up -r "$v1hash" ) >cvs.log 2>&1 &&
454
+ check_start_tree cvswork &&
455
+ check_file cvswork textfile.c v1 &&
456
+ check_file cvswork t2 v1 &&
457
+ check_file cvswork adir/afile v1 &&
458
+ check_file cvswork adir/a2file v1 &&
459
+ check_file cvswork adir/bdir/bfile v1 &&
460
+ check_file cvswork adir/bdir/b2file v1 &&
461
+ check_end_full_tree cvswork v1
462
+'
463
+
464
+test_expect_success 'cvs diff -r v1 -u' '
465
+ ( cd cvswork &&
466
+ cvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&
467
+ test ! -s cvsDiff.out &&
468
+ test ! -s cvs.log
469
+'
470
+
471
+test_expect_success 'cvs diff -N -r v2 -u' '
472
+ ( cd cvswork &&
473
+ test_must_fail cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&
474
+ test ! -s cvs.log &&
475
+ test -s cvsDiff.out &&
476
+ check_diff cvsDiff.out v2 v1 > check_diff.out 2>&1
477
+'
478
+
479
+test_expect_success 'cvs diff -N -r v2 -r v1.2' '
480
+ ( cd cvswork &&
481
+ test_must_fail cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&
482
+ test ! -s cvs.log &&
483
+ test -s cvsDiff.out &&
484
+ check_diff cvsDiff.out v2 v1.2 > check_diff.out 2>&1
485
+'
486
+
487
+test_expect_success 'apply early [cvswork3] diff to b3' '
488
+ git clone -q . gitwork3 &&
489
+ ( cd gitwork3 &&
490
+ git checkout -b b3 v1 &&
491
+ git apply -p0 --index <"$WORKDIR/cvswork3edit.diff" &&
492
+ git commit -m "cvswork3 edits applied" ) &&
493
+ git fetch gitwork3 b3:b3 &&
494
+ git tag v3 b3
495
+'
496
+
497
+test_expect_success 'check [cvswork3] diff' '
498
+ ( cd cvswork3 &&
499
+ test_must_fail cvs -f diff -N -u ) >"$WORKDIR/cvsDiff.out" 2>cvs.log &&
500
+ test ! -s cvs.log &&
501
+ test -s cvsDiff.out &&
502
+ test $(grep Index: cvsDiff.out | wc -l) = 3 &&
503
+ test_cmp cvsDiff.out cvswork3edit.diff &&
504
+ check_diff cvsDiff.out v1 v3 > check_diff.out 2>&1
505
+'
506
+
507
+test_expect_success 'merge early [cvswork3] b3 with b1' '
508
+ ( cd gitwork3 &&
509
+ git merge "message" HEAD b1 )
510
+ git fetch gitwork3 b3:b3 &&
511
+ git tag v3merged b3 &&
512
+ git push --tags gitcvs.git b3:b3
513
+'
514
+
515
+# This test would fail if cvsserver properly created a ".#afile"* file
516
+# for the merge.
517
+# TODO: Validate that the .# file was saved properly, and then
518
+# delete/ignore it when checking the tree.
519
+test_expect_success 'cvs up dirty [cvswork3]' '
520
+ ( cd cvswork3 &&
521
+ cvs -f up &&
522
+ test_must_fail cvs -f diff -N -u >"$WORKDIR/cvsDiff.out" ) >cvs.log 2>&1 &&
523
+ test -s cvsDiff.out &&
524
+ test $(grep Index: cvsDiff.out | wc -l) = 2
525
+ check_start_tree cvswork3 &&
526
+ check_file cvswork3 textfile.c v3merged &&
527
+ check_file cvswork3 t3 v3merged &&
528
+ check_file cvswork3 adir/afile v3merged &&
529
+ check_file cvswork3 adir/a3file v3merged &&
530
+ check_file cvswork3 adir/afile5 v3merged &&
531
+ check_file cvswork3 adir/bdir/bfile v3merged &&
532
+ check_file cvswork3 adir/bdir/b3file v3merged &&
533
+ check_file cvswork3 cdir/cfile v3merged &&
534
+ check_end_full_tree cvswork3 v3merged
535
+'
536
+
537
+# TODO: test cvs status
538
+
539
+test_expect_success 'cvs commit [cvswork3' '
540
+ ( cd cvswork3 &&
541
+ cvs -f commit -m "dirty sandbox after auto-merge"
542
+ ) > cvs.log 2>&1 &&
543
+ check_start_tree cvswork3 &&
544
+ check_file cvswork3 textfile.c v3merged &&
545
+ check_file cvswork3 t3 v3merged &&
546
+ check_file cvswork3 adir/afile v3merged &&
547
+ check_file cvswork3 adir/a3file v3merged &&
548
+ check_file cvswork3 adir/afile5 v3merged &&
549
+ check_file cvswork3 adir/bdir/bfile v3merged &&
550
+ check_file cvswork3 adir/bdir/b3file v3merged &&
551
+ check_file cvswork3 cdir/cfile v3merged &&
552
+ check_end_full_tree cvswork3 v3merged &&
553
+ git fetch gitcvs.git b3:b4 &&
554
+ git tag v4.1 b4 &&
555
+ git diff --exit-code v4.1 v3merged > check_diff_apply.out 2>&1
556
+'
557
+
558
+test_done