Commit a0ab90b8819b86227c944050f223f05c19a12a39

Edward Thomson 2018-12-01T21:53:07

crlf: re-use existing crlf script to create odb Re-use the existing crlf data generation script for creating the to-odb dataset. Also, store the actual file contents instead of the ID so that we can identify differences instead of detecting that differences exist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
diff --git a/tests/resources/crlf/.gitattributes b/tests/resources/crlf/.gitattributes
new file mode 100644
index 0000000..fa1385d
--- /dev/null
+++ b/tests/resources/crlf/.gitattributes
@@ -0,0 +1 @@
+* -text
diff --git a/tests/resources/crlf/all-crlf b/tests/resources/crlf/all-crlf
new file mode 100644
index 0000000..a9a2e89
--- /dev/null
+++ b/tests/resources/crlf/all-crlf
@@ -0,0 +1,4 @@
+crlf
+crlf
+crlf
+crlf
diff --git a/tests/resources/crlf/all-crlf-utf8bom b/tests/resources/crlf/all-crlf-utf8bom
new file mode 100644
index 0000000..0aa76e4
--- /dev/null
+++ b/tests/resources/crlf/all-crlf-utf8bom
@@ -0,0 +1,4 @@
+crlf
+crlf
+crlf
+crlf
diff --git a/tests/resources/crlf/all-lf b/tests/resources/crlf/all-lf
new file mode 100644
index 0000000..799770d
--- /dev/null
+++ b/tests/resources/crlf/all-lf
@@ -0,0 +1,5 @@
+lf
+lf
+lf
+lf
+lf
diff --git a/tests/resources/crlf/all-lf-utf8bom b/tests/resources/crlf/all-lf-utf8bom
new file mode 100644
index 0000000..7cce67e
--- /dev/null
+++ b/tests/resources/crlf/all-lf-utf8bom
@@ -0,0 +1,5 @@
+lf
+lf
+lf
+lf
+lf
diff --git a/tests/resources/crlf/binary-all-crlf b/tests/resources/crlf/binary-all-crlf
new file mode 100644
index 0000000..8534075
--- /dev/null
+++ b/tests/resources/crlf/binary-all-crlf
@@ -0,0 +1,4 @@
+one
+two
+three
+four
diff --git a/tests/resources/crlf/binary-all-lf b/tests/resources/crlf/binary-all-lf
new file mode 100644
index 0000000..af6fcf6
--- /dev/null
+++ b/tests/resources/crlf/binary-all-lf
@@ -0,0 +1,4 @@
+one
+two
+three
+four
diff --git a/tests/resources/crlf/binary-mixed-lf-cr b/tests/resources/crlf/binary-mixed-lf-cr
new file mode 100644
index 0000000..203555c
--- /dev/null
+++ b/tests/resources/crlf/binary-mixed-lf-cr
@@ -0,0 +1,3 @@
+one
+two
three
+four
\ No newline at end of file
diff --git a/tests/resources/crlf/binary-mixed-lf-cr-crlf b/tests/resources/crlf/binary-mixed-lf-cr-crlf
new file mode 100644
index 0000000..aaf083a
--- /dev/null
+++ b/tests/resources/crlf/binary-mixed-lf-cr-crlf
@@ -0,0 +1,3 @@
+one
+two
three
+four
\ No newline at end of file
diff --git a/tests/resources/crlf/few-utf8-chars-crlf b/tests/resources/crlf/few-utf8-chars-crlf
new file mode 100644
index 0000000..0e05288
--- /dev/null
+++ b/tests/resources/crlf/few-utf8-chars-crlf
@@ -0,0 +1,22 @@
+⚽The rest is ASCII01.
+The rest is ASCII02.
+The rest is ASCII03.
+The rest is ASCII04.
+The rest is ASCII05.
+The rest is ASCII06.
+The rest is ASCII07.
+The rest is ASCII08.
+The rest is ASCII09.
+The rest is ASCII10.
+The rest is ASCII11.
+The rest is ASCII12.
+The rest is ASCII13.
+The rest is ASCII14.
+The rest is ASCII15.
+The rest is ASCII16.
+The rest is ASCII17.
+The rest is ASCII18.
+The rest is ASCII19.
+The rest is ASCII20.
+The rest is ASCII21.
+The rest is ASCII22.
diff --git a/tests/resources/crlf/few-utf8-chars-lf b/tests/resources/crlf/few-utf8-chars-lf
new file mode 100644
index 0000000..f4d25b7
--- /dev/null
+++ b/tests/resources/crlf/few-utf8-chars-lf
@@ -0,0 +1,22 @@
+⚽The rest is ASCII01.
+The rest is ASCII02.
+The rest is ASCII03.
+The rest is ASCII04.
+The rest is ASCII05.
+The rest is ASCII06.
+The rest is ASCII07.
+The rest is ASCII08.
+The rest is ASCII09.
+The rest is ASCII10.
+The rest is ASCII11.
+The rest is ASCII12.
+The rest is ASCII13.
+The rest is ASCII14.
+The rest is ASCII15.
+The rest is ASCII16.
+The rest is ASCII17.
+The rest is ASCII18.
+The rest is ASCII19.
+The rest is ASCII20.
+The rest is ASCII21.
+The rest is ASCII22.
diff --git a/tests/resources/crlf/many-utf8-chars-crlf b/tests/resources/crlf/many-utf8-chars-crlf
new file mode 100644
index 0000000..cd574f5
--- /dev/null
+++ b/tests/resources/crlf/many-utf8-chars-crlf
@@ -0,0 +1,4 @@
+Lets sing!
+♫♪♬♩
+Eat food
+🍅🍕
diff --git a/tests/resources/crlf/many-utf8-chars-lf b/tests/resources/crlf/many-utf8-chars-lf
new file mode 100644
index 0000000..9a6c353
--- /dev/null
+++ b/tests/resources/crlf/many-utf8-chars-lf
@@ -0,0 +1,4 @@
+Lets sing!
+♫♪♬♩
+Eat food
+🍅🍕
diff --git a/tests/resources/crlf/mixed-lf-cr b/tests/resources/crlf/mixed-lf-cr
new file mode 100644
index 0000000..d11e7ef
--- /dev/null
+++ b/tests/resources/crlf/mixed-lf-cr
@@ -0,0 +1,3 @@
+one
+two
three
+four
\ No newline at end of file
diff --git a/tests/resources/crlf/mixed-lf-cr-crlf b/tests/resources/crlf/mixed-lf-cr-crlf
new file mode 100644
index 0000000..417786f
--- /dev/null
+++ b/tests/resources/crlf/mixed-lf-cr-crlf
@@ -0,0 +1,3 @@
+one
+two
three
+four
\ No newline at end of file
diff --git a/tests/resources/crlf/more-crlf b/tests/resources/crlf/more-crlf
new file mode 100644
index 0000000..0ff5a53
--- /dev/null
+++ b/tests/resources/crlf/more-crlf
@@ -0,0 +1,5 @@
+crlf
+crlf
+lf
+crlf
+crlf
diff --git a/tests/resources/crlf/more-crlf-utf8bom b/tests/resources/crlf/more-crlf-utf8bom
new file mode 100644
index 0000000..ea030d3
--- /dev/null
+++ b/tests/resources/crlf/more-crlf-utf8bom
@@ -0,0 +1,5 @@
+crlf
+crlf
+lf
+crlf
+crlf
diff --git a/tests/resources/crlf/more-lf b/tests/resources/crlf/more-lf
new file mode 100644
index 0000000..04de00b
--- /dev/null
+++ b/tests/resources/crlf/more-lf
@@ -0,0 +1,5 @@
+lf
+lf
+crlf
+lf
+lf
diff --git a/tests/resources/crlf/more-lf-utf8bom b/tests/resources/crlf/more-lf-utf8bom
new file mode 100644
index 0000000..dc88e3b
--- /dev/null
+++ b/tests/resources/crlf/more-lf-utf8bom
@@ -0,0 +1,5 @@
+lf
+lf
+crlf
+lf
+lf
diff --git a/tests/resources/crlf/zero-byte b/tests/resources/crlf/zero-byte
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/resources/crlf/zero-byte
diff --git a/tests/resources/crlf_data/checkin_input_files/all-crlf b/tests/resources/crlf_data/checkin_input_files/all-crlf
deleted file mode 100644
index a9a2e89..0000000
--- a/tests/resources/crlf_data/checkin_input_files/all-crlf
+++ /dev/null
@@ -1,4 +0,0 @@
-crlf
-crlf
-crlf
-crlf
diff --git a/tests/resources/crlf_data/checkin_input_files/all-crlf-utf8bom b/tests/resources/crlf_data/checkin_input_files/all-crlf-utf8bom
deleted file mode 100644
index 0aa76e4..0000000
--- a/tests/resources/crlf_data/checkin_input_files/all-crlf-utf8bom
+++ /dev/null
@@ -1,4 +0,0 @@
-crlf
-crlf
-crlf
-crlf
diff --git a/tests/resources/crlf_data/checkin_input_files/all-lf b/tests/resources/crlf_data/checkin_input_files/all-lf
deleted file mode 100644
index 799770d..0000000
--- a/tests/resources/crlf_data/checkin_input_files/all-lf
+++ /dev/null
@@ -1,5 +0,0 @@
-lf
-lf
-lf
-lf
-lf
diff --git a/tests/resources/crlf_data/checkin_input_files/all-lf-utf8bom b/tests/resources/crlf_data/checkin_input_files/all-lf-utf8bom
deleted file mode 100644
index 7cce67e..0000000
--- a/tests/resources/crlf_data/checkin_input_files/all-lf-utf8bom
+++ /dev/null
@@ -1,5 +0,0 @@
-lf
-lf
-lf
-lf
-lf
diff --git a/tests/resources/crlf_data/checkin_input_files/binary-all-crlf b/tests/resources/crlf_data/checkin_input_files/binary-all-crlf
deleted file mode 100644
index 8534075..0000000
--- a/tests/resources/crlf_data/checkin_input_files/binary-all-crlf
+++ /dev/null
@@ -1,4 +0,0 @@
-one
-two
-three
-four
diff --git a/tests/resources/crlf_data/checkin_input_files/binary-all-lf b/tests/resources/crlf_data/checkin_input_files/binary-all-lf
deleted file mode 100644
index af6fcf6..0000000
--- a/tests/resources/crlf_data/checkin_input_files/binary-all-lf
+++ /dev/null
@@ -1,4 +0,0 @@
-one
-two
-three
-four
diff --git a/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr b/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr
deleted file mode 100644
index 203555c..0000000
--- a/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr
+++ /dev/null
@@ -1,3 +0,0 @@
-one
-two
three
-four
\ No newline at end of file
diff --git a/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr-crlf b/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr-crlf
deleted file mode 100644
index aaf083a..0000000
--- a/tests/resources/crlf_data/checkin_input_files/binary-mixed-lf-cr-crlf
+++ /dev/null
@@ -1,3 +0,0 @@
-one
-two
three
-four
\ No newline at end of file
diff --git a/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-crlf b/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-crlf
deleted file mode 100644
index 0e05288..0000000
--- a/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-crlf
+++ /dev/null
@@ -1,22 +0,0 @@
-⚽The rest is ASCII01.
-The rest is ASCII02.
-The rest is ASCII03.
-The rest is ASCII04.
-The rest is ASCII05.
-The rest is ASCII06.
-The rest is ASCII07.
-The rest is ASCII08.
-The rest is ASCII09.
-The rest is ASCII10.
-The rest is ASCII11.
-The rest is ASCII12.
-The rest is ASCII13.
-The rest is ASCII14.
-The rest is ASCII15.
-The rest is ASCII16.
-The rest is ASCII17.
-The rest is ASCII18.
-The rest is ASCII19.
-The rest is ASCII20.
-The rest is ASCII21.
-The rest is ASCII22.
diff --git a/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-lf b/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-lf
deleted file mode 100644
index f4d25b7..0000000
--- a/tests/resources/crlf_data/checkin_input_files/few-utf8-chars-lf
+++ /dev/null
@@ -1,22 +0,0 @@
-⚽The rest is ASCII01.
-The rest is ASCII02.
-The rest is ASCII03.
-The rest is ASCII04.
-The rest is ASCII05.
-The rest is ASCII06.
-The rest is ASCII07.
-The rest is ASCII08.
-The rest is ASCII09.
-The rest is ASCII10.
-The rest is ASCII11.
-The rest is ASCII12.
-The rest is ASCII13.
-The rest is ASCII14.
-The rest is ASCII15.
-The rest is ASCII16.
-The rest is ASCII17.
-The rest is ASCII18.
-The rest is ASCII19.
-The rest is ASCII20.
-The rest is ASCII21.
-The rest is ASCII22.
diff --git a/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-crlf b/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-crlf
deleted file mode 100644
index cd574f5..0000000
--- a/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-crlf
+++ /dev/null
@@ -1,4 +0,0 @@
-Lets sing!
-♫♪♬♩
-Eat food
-🍅🍕
diff --git a/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-lf b/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-lf
deleted file mode 100644
index 9a6c353..0000000
--- a/tests/resources/crlf_data/checkin_input_files/many-utf8-chars-lf
+++ /dev/null
@@ -1,4 +0,0 @@
-Lets sing!
-♫♪♬♩
-Eat food
-🍅🍕
diff --git a/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr b/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr
deleted file mode 100644
index d11e7ef..0000000
--- a/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr
+++ /dev/null
@@ -1,3 +0,0 @@
-one
-two
three
-four
\ No newline at end of file
diff --git a/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr-crlf b/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr-crlf
deleted file mode 100644
index 417786f..0000000
--- a/tests/resources/crlf_data/checkin_input_files/mixed-lf-cr-crlf
+++ /dev/null
@@ -1,3 +0,0 @@
-one
-two
three
-four
\ No newline at end of file
diff --git a/tests/resources/crlf_data/checkin_input_files/more-crlf b/tests/resources/crlf_data/checkin_input_files/more-crlf
deleted file mode 100644
index 0ff5a53..0000000
--- a/tests/resources/crlf_data/checkin_input_files/more-crlf
+++ /dev/null
@@ -1,5 +0,0 @@
-crlf
-crlf
-lf
-crlf
-crlf
diff --git a/tests/resources/crlf_data/checkin_input_files/more-crlf-utf8bom b/tests/resources/crlf_data/checkin_input_files/more-crlf-utf8bom
deleted file mode 100644
index ea030d3..0000000
--- a/tests/resources/crlf_data/checkin_input_files/more-crlf-utf8bom
+++ /dev/null
@@ -1,5 +0,0 @@
-crlf
-crlf
-lf
-crlf
-crlf
diff --git a/tests/resources/crlf_data/checkin_input_files/more-lf b/tests/resources/crlf_data/checkin_input_files/more-lf
deleted file mode 100644
index 04de00b..0000000
--- a/tests/resources/crlf_data/checkin_input_files/more-lf
+++ /dev/null
@@ -1,5 +0,0 @@
-lf
-lf
-crlf
-lf
-lf
diff --git a/tests/resources/crlf_data/checkin_input_files/more-lf-utf8bom b/tests/resources/crlf_data/checkin_input_files/more-lf-utf8bom
deleted file mode 100644
index dc88e3b..0000000
--- a/tests/resources/crlf_data/checkin_input_files/more-lf-utf8bom
+++ /dev/null
@@ -1,5 +0,0 @@
-lf
-lf
-crlf
-lf
-lf
diff --git a/tests/resources/crlf_data/checkin_input_files/zero-byte b/tests/resources/crlf_data/checkin_input_files/zero-byte
deleted file mode 100644
index e69de29..0000000
--- a/tests/resources/crlf_data/checkin_input_files/zero-byte
+++ /dev/null
diff --git a/tests/resources/generate_crlf.sh b/tests/resources/generate_crlf.sh
index db109ac..068cad0 100755
--- a/tests/resources/generate_crlf.sh
+++ b/tests/resources/generate_crlf.sh
@@ -67,6 +67,63 @@ create_to_workdir_data() {
 	fi
 }
 
+create_to_odb_data() {
+	local input=$1
+	local output=$2
+	local tempdir=$3
+	local systype=$4
+	local autocrlf=$5
+	local safecrlf=$6
+	local attr=$7
+
+	local destdir="${output}/${systype}_to_odb/autocrlf_${autocrlf},safecrlf_${safecrlf}"
+
+	if [ "$attr" != "" ]; then
+		local attrdir=`echo $attr | sed -e "s/ /,/g" | sed -e "s/=/_/g"`
+		destdir="${destdir},${attrdir}"
+	fi
+
+	if [ "$tempdir" = "" ]; then
+		local workdir="${destdir}/_workdir"
+	else
+		local workdir="${tempdir}/generate_crlf_${RANDOM}"
+	fi
+
+	echo "Creating ${destdir}"
+	mkdir -p "${destdir}"
+
+	git init "${workdir}" >/dev/null
+	git --work-tree="${workdir}" --git-dir="${workdir}/.git" config core.autocrlf "${autocrlf}"
+	git --work-tree="${workdir}" --git-dir="${workdir}/.git" config core.safecrlf "${safecrlf}"
+
+	if [ "$attr" != "" ]; then
+		echo "* ${attr}" > "${workdir}/.gitattributes"
+	fi
+
+	cp ${input}/* ${workdir}
+
+	for path in ${workdir}/*; do
+		filename=$(basename $path)
+		failed=""
+		output=$(git --work-tree="${workdir}" --git-dir="${workdir}/.git" add ${filename} 2>&1) || failed=1
+
+		if [ ! -z "${failed}" -a "${output:0:35}" == "fatal: LF would be replaced by CRLF" ]; then
+			echo "LF would be replaced by CRLF in '${filename}'" > "${destdir}/${filename}.fail"
+		elif [ ! -z "${failed}" -a "${output:0:35}" == "fatal: CRLF would be replaced by LF" ]; then
+			echo "CRLF would be replaced by LF in '${filename}'" > "${destdir}/${filename}.fail"
+		elif [ ! -z "${failed}" ]; then
+			echo "failed to add ${filename}: ${output}" 1>&2
+			exit 1
+		else
+			git --work-tree="${workdir}" --git-dir="${workdir}/.git" cat-file blob ":${filename}" > "${destdir}/${filename}"
+		fi
+	done
+
+	if [ "$tempdir" != "" ]; then
+		rm -rf "${workdir}"
+	fi
+}
+
 if [[ `uname -s` == MINGW* ]]; then
 	systype="windows"
 else
@@ -80,6 +137,11 @@ for autocrlf in true false input; do
 
 		create_to_workdir_data "${input}" "${output}" "${tempdir}" \
 			"${systype}" "${autocrlf}" "${attr}"
+
+		for safecrlf in true false warn; do
+			create_to_odb_data "${input}" "${output}" "${tempdir}" \
+				"${systype}" "${autocrlf}" "${safecrlf}" "${attr}"
+		done
 	done
 done
 
diff --git a/tests/resources/generate_crlf_checkin.sh b/tests/resources/generate_crlf_checkin.sh
deleted file mode 100755
index d94ee99..0000000
--- a/tests/resources/generate_crlf_checkin.sh
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env bash
-#
-# This script will generate the test corpus for CR/LF data using git;
-# we created files with all possible line ending varieties (all LF, all
-# CRLF, mixed, etc) on all the possible line ending configurations
-# (`core.autocrlf=true`, `text=auto` in gitattributes, etc) add add them
-# to git and check the added hash.  This allows us to validate that our
-# configuration will match byte-for-byte the configuration that git produces.
-#
-# To update the test resource data, from the test resource directory:
-#     git rm -r ./crlf_data/checkin_results
-#     sh ./generate_crlf_checkin.sh ./crlf_data/checkin_input_files ./crlf_data/checkin_results /tmp/crlf_gitdirs
-#     git add ./crlf_data/checkin_results
-
-set -e
-
-if [ "$1" == "" -o "$2" == "" ]; then
-	echo "usage: $0 inputfiles-directory directory [tempdir]"
-	exit 1
-fi
-
-input=$1
-output=$2
-tempdir=$3
-
-if [ ${input:1} != "/" ]; then
-	input="$PWD/$input"
-fi
-
-if [ ${output:1} != "/" ]; then
-	output="$PWD/$output"
-fi
-
-if [ "${tempdir}" != "" -a "${tempdir:1}" != "/" ]; then
-	tempdir="$PWD/$tempdir"
-fi
-
-set -u
-
-create_test_data() {
-	local input=$1
-	local output=$2
-	local tempdir=$3
-	local safecrlf=$4
-	local autocrlf=$5
-	local attr=$6
-
-	local destdir="${output}/safecrlf_${safecrlf},autocrlf_${autocrlf}"
-
-	if [ "$attr" != "" ]; then
-		local attrdir=`echo $attr | sed -e "s/ /,/g" | sed -e "s/=/_/g"`
-		destdir="${destdir},${attrdir}"
-	fi
-
-	if [ "$tempdir" = "" ]; then
-		tempdir="${output}/generate_crlf_${RANDOM}"
-	else
-		tempdir="${tempdir}/generate_crlf_${RANDOM}"
-	fi
-
-	echo "Generating ${destdir}"
-	mkdir -p "${destdir}"
-	mkdir -p "${tempdir}"
-
-	git init "${tempdir}"
-	if [ "$attr" != "" ]; then
-		echo "* ${attr}" > "${tempdir}/.gitattributes"
-	fi
-	cp "$input"/* "${tempdir}"
-	pushd "${tempdir}"
-		git config core.autocrlf ${autocrlf}
-		git config core.safecrlf ${safecrlf}
-		for file in *
-		do
-			process_file "$destdir" "$file"
-		done
-	popd
-
-	rm -rf "$tempdir"
-}
-
-function process_file() {
-	destdir=$1
-	file=$2
-
-	rm -f "$destdir/$file.obj" "$destdir/$file.fail"
-
-	set +e
-	OUTPUT=$(git add "$file" 2>&1)
-	if [ $? -ne 0 ]; then
-		set -e
-		touch "$destdir/$file.fail"
-		if [ "${OUTPUT:0:38}" == "fatal: CRLF would be replaced by LF in" ]; then
-			echo "CRLF would be replaced by LF" > "$destdir/$file.fail"
-		elif [ "${OUTPUT:0:38}" == "fatal: LF would be replaced by CRLF in" ]; then
-			echo "LF would be replaced by CRLF" > "$destdir/$file.fail"
-		fi
-	else
-		OBJ=$(git ls-files -s | cut -d ' ' -f 2)
- 		set -e
-		echo "$OBJ" > "$destdir/$file.obj"
-	fi
-	rm -f .git/index
-}
-
-export LC_ALL=C
-
-for safecrlf in true false warn; do
-	for autocrlf in true false input; do
-		for attr in "" text text=auto -text crlf -crlf eol=lf eol=crlf \
-			"text eol=lf" "text eol=crlf" \
-			"text=auto eol=lf" "text=auto eol=crlf"; do
-	
-			create_test_data "${input}" "${output}" "${tempdir}" \
-				"${safecrlf}" "${autocrlf}" "${attr}"
-		done
-	done
-done