modernize t9300: move test preparations into test_expect_success
Our usual style these days is to execute everything inside test_expect_success. Make it so. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jeff King <peff@peff.net>
Johannes Sixt committed
Nov 19, 2015 at 20:09 UTC
68297e0fd889ae4f99b184e1dbd0fd3ed5f09493
1 file changed
+1297
-1283
t/t9300-fast-import.sh
+1297
-1283
@@ -51,54 +51,53 @@ echo "$@"'
51
### series A
52
###
53
54
-test_tick
55
-
54
test_expect_success 'empty stream succeeds' '
55
git fast-import </dev/null
56
'
57
60
-cat >input <<-INPUT_END &&
61
-blob
62
-mark :2
63
-data <<EOF
64
-$file2_data
65
-EOF
66
-
67
-blob
68
-mark :3
69
-data <<END
70
-$file3_data
71
-END
72
-
73
-blob
74
-mark :4
75
-data $file4_len
76
-$file4_data
77
-commit refs/heads/master
78
-mark :5
79
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
80
-data <<COMMIT
81
-initial
82
-COMMIT
83
-
84
-M 644 :2 file2
85
-M 644 :3 file3
86
-M 755 :4 file4
87
-
88
-tag series-A
89
-from :5
90
-data <<EOF
91
-An annotated tag without a tagger
92
-EOF
93
-
94
-tag series-A-blob
95
-from :3
96
-data <<EOF
97
-An annotated tag that annotates a blob.
98
-EOF
99
-
100
-INPUT_END
58
test_expect_success 'A: create pack from stdin' '
59
+ test_tick &&
60
+ cat >input <<-INPUT_END &&
61
+ blob
62
+ mark :2
63
+ data <<EOF
64
+ $file2_data
65
+ EOF
66
+
67
+ blob
68
+ mark :3
69
+ data <<END
70
+ $file3_data
71
+ END
72
+
73
+ blob
74
+ mark :4
75
+ data $file4_len
76
+ $file4_data
77
+ commit refs/heads/master
78
+ mark :5
79
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
80
+ data <<COMMIT
81
+ initial
82
+ COMMIT
83
+
84
+ M 644 :2 file2
85
+ M 644 :3 file3
86
+ M 755 :4 file4
87
+
88
+ tag series-A
89
+ from :5
90
+ data <<EOF
91
+ An annotated tag without a tagger
92
+ EOF
93
+
94
+ tag series-A-blob
95
+ from :3
96
+ data <<EOF
97
+ An annotated tag that annotates a blob.
98
+ EOF
99
+
100
+ INPUT_END
101
git fast-import --export-marks=marks.out <input &&
102
git whatchanged master
103
'
@@ -107,76 +106,76 @@ test_expect_success 'A: verify pack' '
106
verify_packs
107
'
108
110
-cat >expect <<-EOF &&
111
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
112
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
113
-
114
-initial
115
-EOF
109
test_expect_success 'A: verify commit' '
110
+ cat >expect <<-EOF &&
111
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
112
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
113
+
114
+ initial
115
+ EOF
116
git cat-file commit master | sed 1d >actual &&
117
test_cmp expect actual
118
'
119
121
-cat >expect <<-EOF &&
122
-100644 blob file2
123
-100644 blob file3
124
-100755 blob file4
125
-EOF
120
test_expect_success 'A: verify tree' '
121
+ cat >expect <<-EOF &&
122
+ 100644 blob file2
123
+ 100644 blob file3
124
+ 100755 blob file4
125
+ EOF
126
git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
127
test_cmp expect actual
128
'
129
131
-echo "$file2_data" >expect
130
test_expect_success 'A: verify file2' '
131
+ echo "$file2_data" >expect &&
132
git cat-file blob master:file2 >actual &&
133
test_cmp expect actual
134
'
135
137
-echo "$file3_data" >expect
136
test_expect_success 'A: verify file3' '
137
+ echo "$file3_data" >expect &&
138
git cat-file blob master:file3 >actual &&
139
test_cmp expect actual
140
'
141
143
-printf "$file4_data" >expect
142
test_expect_success 'A: verify file4' '
143
+ printf "$file4_data" >expect &&
144
git cat-file blob master:file4 >actual &&
145
test_cmp expect actual
146
'
147
149
-cat >expect <<-EOF &&
150
-object $(git rev-parse refs/heads/master)
151
-type commit
152
-tag series-A
153
-
154
-An annotated tag without a tagger
155
-EOF
148
test_expect_success 'A: verify tag/series-A' '
149
+ cat >expect <<-EOF &&
150
+ object $(git rev-parse refs/heads/master)
151
+ type commit
152
+ tag series-A
153
+
154
+ An annotated tag without a tagger
155
+ EOF
156
git cat-file tag tags/series-A >actual &&
157
test_cmp expect actual
158
'
159
161
-cat >expect <<-EOF &&
162
-object $(git rev-parse refs/heads/master:file3)
163
-type blob
164
-tag series-A-blob
165
-
166
-An annotated tag that annotates a blob.
167
-EOF
160
test_expect_success 'A: verify tag/series-A-blob' '
161
+ cat >expect <<-EOF &&
162
+ object $(git rev-parse refs/heads/master:file3)
163
+ type blob
164
+ tag series-A-blob
165
+
166
+ An annotated tag that annotates a blob.
167
+ EOF
168
git cat-file tag tags/series-A-blob >actual &&
169
test_cmp expect actual
170
'
171
173
-cat >expect <<-EOF &&
174
-:2 `git rev-parse --verify master:file2`
175
-:3 `git rev-parse --verify master:file3`
176
-:4 `git rev-parse --verify master:file4`
177
-:5 `git rev-parse --verify master^0`
178
-EOF
172
test_expect_success 'A: verify marks output' '
173
+ cat >expect <<-EOF &&
174
+ :2 `git rev-parse --verify master:file2`
175
+ :3 `git rev-parse --verify master:file3`
176
+ :4 `git rev-parse --verify master:file4`
177
+ :5 `git rev-parse --verify master^0`
178
+ EOF
179
test_cmp expect marks.out
180
'
181
@@ -188,68 +187,69 @@ test_expect_success 'A: verify marks import' '
187
test_cmp expect marks.new
188
'
189
191
-test_tick
192
-new_blob=$(echo testing | git hash-object --stdin)
193
-cat >input <<-INPUT_END &&
194
-tag series-A-blob-2
195
-from $(git rev-parse refs/heads/master:file3)
196
-data <<EOF
197
-Tag blob by sha1.
198
-EOF
199
-
200
-blob
201
-mark :6
202
-data <<EOF
203
-testing
204
-EOF
205
-
206
-commit refs/heads/new_blob
207
-committer <> 0 +0000
208
-data 0
209
-M 644 :6 new_blob
210
-#pretend we got sha1 from fast-import
211
-ls "new_blob"
212
-
213
-tag series-A-blob-3
214
-from $new_blob
215
-data <<EOF
216
-Tag new_blob.
217
-EOF
218
-INPUT_END
219
-
220
-cat >expect <<-EOF &&
221
-object $(git rev-parse refs/heads/master:file3)
222
-type blob
223
-tag series-A-blob-2
224
-
225
-Tag blob by sha1.
226
-object $new_blob
227
-type blob
228
-tag series-A-blob-3
229
-
230
-Tag new_blob.
231
-EOF
232
-
190
test_expect_success 'A: tag blob by sha1' '
191
+ test_tick &&
192
+ new_blob=$(echo testing | git hash-object --stdin) &&
193
+ cat >input <<-INPUT_END &&
194
+ tag series-A-blob-2
195
+ from $(git rev-parse refs/heads/master:file3)
196
+ data <<EOF
197
+ Tag blob by sha1.
198
+ EOF
199
+
200
+ blob
201
+ mark :6
202
+ data <<EOF
203
+ testing
204
+ EOF
205
+
206
+ commit refs/heads/new_blob
207
+ committer <> 0 +0000
208
+ data 0
209
+ M 644 :6 new_blob
210
+ #pretend we got sha1 from fast-import
211
+ ls "new_blob"
212
+
213
+ tag series-A-blob-3
214
+ from $new_blob
215
+ data <<EOF
216
+ Tag new_blob.
217
+ EOF
218
+ INPUT_END
219
+
220
+ cat >expect <<-EOF &&
221
+ object $(git rev-parse refs/heads/master:file3)
222
+ type blob
223
+ tag series-A-blob-2
224
+
225
+ Tag blob by sha1.
226
+ object $new_blob
227
+ type blob
228
+ tag series-A-blob-3
229
+
230
+ Tag new_blob.
231
+ EOF
232
+
233
git fast-import <input &&
234
git cat-file tag tags/series-A-blob-2 >actual &&
235
git cat-file tag tags/series-A-blob-3 >>actual &&
236
test_cmp expect actual
237
'
238
240
-test_tick
241
-cat >input <<-INPUT_END &&
242
-commit refs/heads/verify--import-marks
243
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
244
-data <<COMMIT
245
-recreate from :5
246
-COMMIT
239
+test_expect_success 'A: verify marks import does not crash' '
240
+ test_tick &&
241
+ cat >input <<-INPUT_END &&
242
+ commit refs/heads/verify--import-marks
243
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
244
+ data <<COMMIT
245
+ recreate from :5
246
+ COMMIT
247
+
248
+ from :5
249
+ M 755 :2 copy-of-file2
250
248
-from :5
249
-M 755 :2 copy-of-file2
251
+ INPUT_END
252
251
-INPUT_END
252
-test_expect_success 'A: verify marks import does not crash' '
253
git fast-import --import-marks=marks.out <input &&
254
git whatchanged verify--import-marks
255
'
@@ -258,68 +258,66 @@ test_expect_success 'A: verify pack' '
258
verify_packs
259
'
260
261
-cat >expect <<-EOF &&
262
-:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
263
-EOF
264
-git diff-tree -M -r master verify--import-marks >actual
261
test_expect_success 'A: verify diff' '
262
+ cat >expect <<-EOF &&
263
+ :000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
264
+ EOF
265
+ git diff-tree -M -r master verify--import-marks >actual &&
266
compare_diff_raw expect actual &&
267
test `git rev-parse --verify master:file2` \
268
= `git rev-parse --verify verify--import-marks:copy-of-file2`
269
'
270
271
-test_tick
272
-mt=$(git hash-object --stdin < /dev/null)
273
-: >input.blob
274
-: >marks.exp
275
-: >tree.exp
276
-
277
-cat >input.commit <<-EOF &&
278
-commit refs/heads/verify--dump-marks
279
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
280
-data <<COMMIT
281
-test the sparse array dumping routines with exponentially growing marks
282
-COMMIT
283
-EOF
284
-
285
-i=0
286
-l=4
287
-m=6
288
-n=7
289
-while test "$i" -lt 27; do
290
- cat >>input.blob <<-EOF &&
291
-blob
292
-mark :$l
293
-data 0
294
-blob
295
-mark :$m
296
-data 0
297
-blob
298
-mark :$n
299
-data 0
300
-EOF
301
- echo "M 100644 :$l l$i" >>input.commit
302
- echo "M 100644 :$m m$i" >>input.commit
303
- echo "M 100644 :$n n$i" >>input.commit
304
-
305
- echo ":$l $mt" >>marks.exp
306
- echo ":$m $mt" >>marks.exp
307
- echo ":$n $mt" >>marks.exp
308
-
309
- printf "100644 blob $mt\tl$i\n" >>tree.exp
310
- printf "100644 blob $mt\tm$i\n" >>tree.exp
311
- printf "100644 blob $mt\tn$i\n" >>tree.exp
312
-
313
- l=$(($l + $l))
314
- m=$(($m + $m))
315
- n=$(($l + $n))
316
-
317
- i=$((1 + $i))
318
-done
319
-
320
-sort tree.exp > tree.exp_s
321
-
271
test_expect_success 'A: export marks with large values' '
272
+ test_tick &&
273
+ mt=$(git hash-object --stdin < /dev/null) &&
274
+ >input.blob &&
275
+ >marks.exp &&
276
+ >tree.exp &&
277
+
278
+ cat >input.commit <<-EOF &&
279
+ commit refs/heads/verify--dump-marks
280
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
281
+ data <<COMMIT
282
+ test the sparse array dumping routines with exponentially growing marks
283
+ COMMIT
284
+ EOF
285
+
286
+ i=0 l=4 m=6 n=7 &&
287
+ while test "$i" -lt 27
288
+ do
289
+ cat >>input.blob <<-EOF &&
290
+ blob
291
+ mark :$l
292
+ data 0
293
+ blob
294
+ mark :$m
295
+ data 0
296
+ blob
297
+ mark :$n
298
+ data 0
299
+ EOF
300
+ echo "M 100644 :$l l$i" >>input.commit &&
301
+ echo "M 100644 :$m m$i" >>input.commit &&
302
+ echo "M 100644 :$n n$i" >>input.commit &&
303
+
304
+ echo ":$l $mt" >>marks.exp &&
305
+ echo ":$m $mt" >>marks.exp &&
306
+ echo ":$n $mt" >>marks.exp &&
307
+
308
+ printf "100644 blob $mt\tl$i\n" >>tree.exp &&
309
+ printf "100644 blob $mt\tm$i\n" >>tree.exp &&
310
+ printf "100644 blob $mt\tn$i\n" >>tree.exp &&
311
+
312
+ l=$(($l + $l)) &&
313
+ m=$(($m + $m)) &&
314
+ n=$(($l + $n)) &&
315
+
316
+ i=$((1 + $i)) || return 1
317
+ done &&
318
+
319
+ sort tree.exp > tree.exp_s &&
320
+
321
cat input.blob input.commit | git fast-import --export-marks=marks.large &&
322
git ls-tree refs/heads/verify--dump-marks >tree.out &&
323
test_cmp tree.exp_s tree.out &&
@@ -330,35 +328,37 @@ test_expect_success 'A: export marks with large values' '
328
### series B
329
###
330
333
-test_tick
334
-cat >input <<-INPUT_END &&
335
-commit refs/heads/branch
336
-mark :1
337
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
338
-data <<COMMIT
339
-corrupt
340
-COMMIT
331
+test_expect_success 'B: fail on invalid blob sha1' '
332
+ test_tick &&
333
+ cat >input <<-INPUT_END &&
334
+ commit refs/heads/branch
335
+ mark :1
336
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
337
+ data <<COMMIT
338
+ corrupt
339
+ COMMIT
340
+
341
+ from refs/heads/master
342
+ M 755 0000000000000000000000000000000000000001 zero1
343
342
-from refs/heads/master
343
-M 755 0000000000000000000000000000000000000001 zero1
344
+ INPUT_END
345
345
-INPUT_END
346
-test_expect_success 'B: fail on invalid blob sha1' '
346
test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
347
test_must_fail git fast-import <input
348
'
349
351
-cat >input <<-INPUT_END &&
352
-commit TEMP_TAG
353
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
354
-data <<COMMIT
355
-tag base
356
-COMMIT
350
+test_expect_success 'B: accept branch name "TEMP_TAG"' '
351
+ cat >input <<-INPUT_END &&
352
+ commit TEMP_TAG
353
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
354
+ data <<COMMIT
355
+ tag base
356
+ COMMIT
357
+
358
+ from refs/heads/master
359
358
-from refs/heads/master
360
+ INPUT_END
361
360
-INPUT_END
361
-test_expect_success 'B: accept branch name "TEMP_TAG"' '
362
test_when_finished "rm -f .git/TEMP_TAG
363
git gc
364
git prune" &&
@@ -367,14 +367,15 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
367
test `git rev-parse master` = `git rev-parse TEMP_TAG^`
368
'
369
370
-cat >input <<-INPUT_END &&
371
-commit refs/heads/empty-committer-1
372
-committer <> $GIT_COMMITTER_DATE
373
-data <<COMMIT
374
-empty commit
375
-COMMIT
376
-INPUT_END
370
test_expect_success 'B: accept empty committer' '
371
+ cat >input <<-INPUT_END &&
372
+ commit refs/heads/empty-committer-1
373
+ committer <> $GIT_COMMITTER_DATE
374
+ data <<COMMIT
375
+ empty commit
376
+ COMMIT
377
+ INPUT_END
378
+
379
test_when_finished "git update-ref -d refs/heads/empty-committer-1
380
git gc
381
git prune" &&
@@ -384,14 +385,15 @@ test_expect_success 'B: accept empty committer' '
385
test -z "$out"
386
'
387
387
-cat >input <<-INPUT_END &&
388
-commit refs/heads/empty-committer-2
389
-committer <a@b.com> $GIT_COMMITTER_DATE
390
-data <<COMMIT
391
-empty commit
392
-COMMIT
393
-INPUT_END
388
test_expect_success 'B: accept and fixup committer with no name' '
389
+ cat >input <<-INPUT_END &&
390
+ commit refs/heads/empty-committer-2
391
+ committer <a@b.com> $GIT_COMMITTER_DATE
392
+ data <<COMMIT
393
+ empty commit
394
+ COMMIT
395
+ INPUT_END
396
+
397
test_when_finished "git update-ref -d refs/heads/empty-committer-2
398
git gc
399
git prune" &&
@@ -401,62 +403,67 @@ test_expect_success 'B: accept and fixup committer with no name' '
403
test -z "$out"
404
'
405
404
-cat >input <<-INPUT_END &&
405
-commit refs/heads/invalid-committer
406
-committer Name email> $GIT_COMMITTER_DATE
407
-data <<COMMIT
408
-empty commit
409
-COMMIT
410
-INPUT_END
406
test_expect_success 'B: fail on invalid committer (1)' '
407
+ cat >input <<-INPUT_END &&
408
+ commit refs/heads/invalid-committer
409
+ committer Name email> $GIT_COMMITTER_DATE
410
+ data <<COMMIT
411
+ empty commit
412
+ COMMIT
413
+ INPUT_END
414
+
415
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
416
test_must_fail git fast-import <input
417
'
418
416
-cat >input <<-INPUT_END &&
417
-commit refs/heads/invalid-committer
418
-committer Name <e<mail> $GIT_COMMITTER_DATE
419
-data <<COMMIT
420
-empty commit
421
-COMMIT
422
-INPUT_END
419
test_expect_success 'B: fail on invalid committer (2)' '
420
+ cat >input <<-INPUT_END &&
421
+ commit refs/heads/invalid-committer
422
+ committer Name <e<mail> $GIT_COMMITTER_DATE
423
+ data <<COMMIT
424
+ empty commit
425
+ COMMIT
426
+ INPUT_END
427
+
428
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
429
test_must_fail git fast-import <input
430
'
431
428
-cat >input <<-INPUT_END &&
429
-commit refs/heads/invalid-committer
430
-committer Name <email>> $GIT_COMMITTER_DATE
431
-data <<COMMIT
432
-empty commit
433
-COMMIT
434
-INPUT_END
432
test_expect_success 'B: fail on invalid committer (3)' '
433
+ cat >input <<-INPUT_END &&
434
+ commit refs/heads/invalid-committer
435
+ committer Name <email>> $GIT_COMMITTER_DATE
436
+ data <<COMMIT
437
+ empty commit
438
+ COMMIT
439
+ INPUT_END
440
+
441
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
442
test_must_fail git fast-import <input
443
'
444
440
-cat >input <<-INPUT_END &&
441
-commit refs/heads/invalid-committer
442
-committer Name <email $GIT_COMMITTER_DATE
443
-data <<COMMIT
444
-empty commit
445
-COMMIT
446
-INPUT_END
445
test_expect_success 'B: fail on invalid committer (4)' '
446
+ cat >input <<-INPUT_END &&
447
+ commit refs/heads/invalid-committer
448
+ committer Name <email $GIT_COMMITTER_DATE
449
+ data <<COMMIT
450
+ empty commit
451
+ COMMIT
452
+ INPUT_END
453
+
454
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
455
test_must_fail git fast-import <input
456
'
457
452
-cat >input <<-INPUT_END &&
453
-commit refs/heads/invalid-committer
454
-committer Name<email> $GIT_COMMITTER_DATE
455
-data <<COMMIT
456
-empty commit
457
-COMMIT
458
-INPUT_END
458
test_expect_success 'B: fail on invalid committer (5)' '
459
+ cat >input <<-INPUT_END &&
460
+ commit refs/heads/invalid-committer
461
+ committer Name<email> $GIT_COMMITTER_DATE
462
+ data <<COMMIT
463
+ empty commit
464
+ COMMIT
465
+ INPUT_END
466
+
467
test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
468
test_must_fail git fast-import <input
469
'
@@ -465,23 +472,24 @@ test_expect_success 'B: fail on invalid committer (5)' '
472
### series C
473
###
474
468
-newf=`echo hi newf | git hash-object -w --stdin`
469
-oldf=`git rev-parse --verify master:file2`
470
-test_tick
471
-cat >input <<-INPUT_END &&
472
-commit refs/heads/branch
473
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
474
-data <<COMMIT
475
-second
476
-COMMIT
477
-
478
-from refs/heads/master
479
-M 644 $oldf file2/oldf
480
-M 755 $newf file2/newf
481
-D file3
482
-
483
-INPUT_END
475
test_expect_success 'C: incremental import create pack from stdin' '
476
+ newf=`echo hi newf | git hash-object -w --stdin` &&
477
+ oldf=`git rev-parse --verify master:file2` &&
478
+ test_tick &&
479
+ cat >input <<-INPUT_END &&
480
+ commit refs/heads/branch
481
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
482
+ data <<COMMIT
483
+ second
484
+ COMMIT
485
+
486
+ from refs/heads/master
487
+ M 644 $oldf file2/oldf
488
+ M 755 $newf file2/newf
489
+ D file3
490
+
491
+ INPUT_END
492
+
493
git fast-import <input &&
494
git whatchanged branch
495
'
@@ -495,25 +503,26 @@ test_expect_success 'C: validate reuse existing blob' '
503
test $oldf = `git rev-parse --verify branch:file2/oldf`
504
'
505
498
-cat >expect <<-EOF &&
499
-parent `git rev-parse --verify master^0`
500
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
501
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
502
-
503
-second
504
-EOF
506
test_expect_success 'C: verify commit' '
507
+ cat >expect <<-EOF &&
508
+ parent `git rev-parse --verify master^0`
509
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
510
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
511
+
512
+ second
513
+ EOF
514
+
515
git cat-file commit branch | sed 1d >actual &&
516
test_cmp expect actual
517
'
518
510
-cat >expect <<-EOF &&
511
-:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
512
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
513
-:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
514
-EOF
515
-git diff-tree -M -r master branch >actual
519
test_expect_success 'C: validate rename result' '
520
+ cat >expect <<-EOF &&
521
+ :000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
522
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
523
+ :100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
524
+ EOF
525
+ git diff-tree -M -r master branch >actual &&
526
compare_diff_raw expect actual
527
'
528
@@ -521,27 +530,28 @@ test_expect_success 'C: validate rename result' '
530
### series D
531
###
532
524
-test_tick
525
-cat >input <<-INPUT_END &&
526
-commit refs/heads/branch
527
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
528
-data <<COMMIT
529
-third
530
-COMMIT
531
-
532
-from refs/heads/branch^0
533
-M 644 inline newdir/interesting
534
-data <<EOF
535
-$file5_data
536
-EOF
537
-
538
-M 755 inline newdir/exec.sh
539
-data <<EOF
540
-$file6_data
541
-EOF
542
-
543
-INPUT_END
533
test_expect_success 'D: inline data in commit' '
534
+ test_tick &&
535
+ cat >input <<-INPUT_END &&
536
+ commit refs/heads/branch
537
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
538
+ data <<COMMIT
539
+ third
540
+ COMMIT
541
+
542
+ from refs/heads/branch^0
543
+ M 644 inline newdir/interesting
544
+ data <<EOF
545
+ $file5_data
546
+ EOF
547
+
548
+ M 755 inline newdir/exec.sh
549
+ data <<EOF
550
+ $file6_data
551
+ EOF
552
+
553
+ INPUT_END
554
+
555
git fast-import <input &&
556
git whatchanged branch
557
'
@@ -550,23 +560,23 @@ test_expect_success 'D: verify pack' '
560
verify_packs
561
'
562
553
-cat >expect <<-EOF &&
554
-:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
555
-:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
556
-EOF
557
-git diff-tree -M -r branch^ branch >actual
563
test_expect_success 'D: validate new files added' '
564
+ cat >expect <<-EOF &&
565
+ :000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A newdir/exec.sh
566
+ :000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A newdir/interesting
567
+ EOF
568
+ git diff-tree -M -r branch^ branch >actual &&
569
compare_diff_raw expect actual
570
'
571
562
-echo "$file5_data" >expect
572
test_expect_success 'D: verify file5' '
573
+ echo "$file5_data" >expect &&
574
git cat-file blob branch:newdir/interesting >actual &&
575
test_cmp expect actual
576
'
577
568
-echo "$file6_data" >expect
578
test_expect_success 'D: verify file6' '
579
+ echo "$file6_data" >expect &&
580
git cat-file blob branch:newdir/exec.sh >actual &&
581
test_cmp expect actual
582
'
@@ -575,18 +585,19 @@ test_expect_success 'D: verify file6' '
585
### series E
586
###
587
578
-cat >input <<-INPUT_END &&
579
-commit refs/heads/branch
580
-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
581
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
582
-data <<COMMIT
583
-RFC 2822 type date
584
-COMMIT
588
+test_expect_success 'E: rfc2822 date, --date-format=raw' '
589
+ cat >input <<-INPUT_END &&
590
+ commit refs/heads/branch
591
+ author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
592
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
593
+ data <<COMMIT
594
+ RFC 2822 type date
595
+ COMMIT
596
+
597
+ from refs/heads/branch^0
598
586
-from refs/heads/branch^0
599
+ INPUT_END
600
588
-INPUT_END
589
-test_expect_success 'E: rfc2822 date, --date-format=raw' '
601
test_must_fail git fast-import --date-format=raw <input
602
'
603
test_expect_success 'E: rfc2822 date, --date-format=rfc2822' '
@@ -597,13 +608,13 @@ test_expect_success 'E: verify pack' '
608
verify_packs
609
'
610
600
-cat >expect <<-EOF &&
601
-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
602
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
603
-
604
-RFC 2822 type date
605
-EOF
611
test_expect_success 'E: verify commit' '
612
+ cat >expect <<-EOF &&
613
+ author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
614
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
615
+
616
+ RFC 2822 type date
617
+ EOF
618
git cat-file commit branch | sed 1,2d >actual &&
619
test_cmp expect actual
620
'
@@ -612,22 +623,23 @@ test_expect_success 'E: verify commit' '
623
### series F
624
###
625
615
-old_branch=`git rev-parse --verify branch^0`
616
-test_tick
617
-cat >input <<-INPUT_END &&
618
-commit refs/heads/branch
619
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
620
-data <<COMMIT
621
-losing things already?
622
-COMMIT
626
+test_expect_success 'F: non-fast-forward update skips' '
627
+ old_branch=`git rev-parse --verify branch^0` &&
628
+ test_tick &&
629
+ cat >input <<-INPUT_END &&
630
+ commit refs/heads/branch
631
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
632
+ data <<COMMIT
633
+ losing things already?
634
+ COMMIT
635
624
-from refs/heads/branch~1
636
+ from refs/heads/branch~1
637
626
-reset refs/heads/other
627
-from refs/heads/branch
638
+ reset refs/heads/other
639
+ from refs/heads/branch
640
+
641
+ INPUT_END
642
629
-INPUT_END
630
-test_expect_success 'F: non-fast-forward update skips' '
643
test_must_fail git fast-import <input &&
644
# branch must remain unaffected
645
test $old_branch = `git rev-parse --verify branch^0`
@@ -637,15 +649,15 @@ test_expect_success 'F: verify pack' '
649
verify_packs
650
'
651
640
-cat >expect <<-EOF &&
641
-tree `git rev-parse branch~1^{tree}`
642
-parent `git rev-parse branch~1`
643
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
644
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
645
-
646
-losing things already?
647
-EOF
652
test_expect_success 'F: verify other commit' '
653
+ cat >expect <<-EOF &&
654
+ tree `git rev-parse branch~1^{tree}`
655
+ parent `git rev-parse branch~1`
656
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
657
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
658
+
659
+ losing things already?
660
+ EOF
661
git cat-file commit other >actual &&
662
test_cmp expect actual
663
'
@@ -654,19 +666,19 @@ test_expect_success 'F: verify other commit' '
666
### series G
667
###
668
657
-old_branch=`git rev-parse --verify branch^0`
658
-test_tick
659
-cat >input <<-INPUT_END &&
660
-commit refs/heads/branch
661
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
662
-data <<COMMIT
663
-losing things already?
664
-COMMIT
669
+test_expect_success 'G: non-fast-forward update forced' '
670
+ old_branch=`git rev-parse --verify branch^0` &&
671
+ test_tick &&
672
+ cat >input <<-INPUT_END &&
673
+ commit refs/heads/branch
674
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
675
+ data <<COMMIT
676
+ losing things already?
677
+ COMMIT
678
666
-from refs/heads/branch~1
679
+ from refs/heads/branch~1
680
668
-INPUT_END
669
-test_expect_success 'G: non-fast-forward update forced' '
681
+ INPUT_END
682
git fast-import --force <input
683
'
684
@@ -683,28 +695,28 @@ test_expect_success 'G: branch changed, but logged' '
695
### series H
696
###
697
686
-test_tick
687
-cat >input <<-INPUT_END &&
688
-commit refs/heads/H
689
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
690
-data <<COMMIT
691
-third
692
-COMMIT
693
-
694
-from refs/heads/branch^0
695
-M 644 inline i-will-die
696
-data <<EOF
697
-this file will never exist.
698
-EOF
699
-
700
-deleteall
701
-M 644 inline h/e/l/lo
702
-data <<EOF
703
-$file5_data
704
-EOF
705
-
706
-INPUT_END
698
test_expect_success 'H: deletall, add 1' '
699
+ test_tick &&
700
+ cat >input <<-INPUT_END &&
701
+ commit refs/heads/H
702
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
703
+ data <<COMMIT
704
+ third
705
+ COMMIT
706
+
707
+ from refs/heads/branch^0
708
+ M 644 inline i-will-die
709
+ data <<EOF
710
+ this file will never exist.
711
+ EOF
712
+
713
+ deleteall
714
+ M 644 inline h/e/l/lo
715
+ data <<EOF
716
+ $file5_data
717
+ EOF
718
+
719
+ INPUT_END
720
git fast-import <input &&
721
git whatchanged H
722
'
@@ -713,20 +725,20 @@ test_expect_success 'H: verify pack' '
725
verify_packs
726
'
727
716
-cat >expect <<-EOF &&
717
-:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
718
-:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
719
-:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
720
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
721
-:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
722
-EOF
723
-git diff-tree -M -r H^ H >actual
728
test_expect_success 'H: validate old files removed, new files added' '
729
+ cat >expect <<-EOF &&
730
+ :100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
731
+ :100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
732
+ :100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
733
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
734
+ :100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
735
+ EOF
736
+ git diff-tree -M -r H^ H >actual &&
737
compare_diff_raw expect actual
738
'
739
728
-echo "$file5_data" >expect
740
test_expect_success 'H: verify file' '
741
+ echo "$file5_data" >expect &&
742
git cat-file blob H:h/e/l/lo >actual &&
743
test_cmp expect actual
744
'
@@ -735,24 +747,24 @@ test_expect_success 'H: verify file' '
747
### series I
748
###
749
738
-cat >input <<-INPUT_END &&
739
-commit refs/heads/export-boundary
740
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
741
-data <<COMMIT
742
-we have a border. its only 40 characters wide.
743
-COMMIT
750
+test_expect_success 'I: export-pack-edges' '
751
+ cat >input <<-INPUT_END &&
752
+ commit refs/heads/export-boundary
753
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
754
+ data <<COMMIT
755
+ we have a border. its only 40 characters wide.
756
+ COMMIT
757
745
-from refs/heads/branch
758
+ from refs/heads/branch
759
747
-INPUT_END
748
-test_expect_success 'I: export-pack-edges' '
760
+ INPUT_END
761
git fast-import --export-pack-edges=edges.list <input
762
'
763
752
-cat >expect <<-EOF &&
753
-.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
754
-EOF
764
test_expect_success 'I: verify edge list' '
765
+ cat >expect <<-EOF &&
766
+ .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
767
+ EOF
768
sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
769
test_cmp expect actual
770
'
@@ -761,25 +773,25 @@ test_expect_success 'I: verify edge list' '
773
### series J
774
###
775
764
-cat >input <<-INPUT_END &&
765
-commit refs/heads/J
766
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
767
-data <<COMMIT
768
-create J
769
-COMMIT
776
+test_expect_success 'J: reset existing branch creates empty commit' '
777
+ cat >input <<-INPUT_END &&
778
+ commit refs/heads/J
779
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
780
+ data <<COMMIT
781
+ create J
782
+ COMMIT
783
771
-from refs/heads/branch
784
+ from refs/heads/branch
785
773
-reset refs/heads/J
786
+ reset refs/heads/J
787
775
-commit refs/heads/J
776
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
777
-data <<COMMIT
778
-initialize J
779
-COMMIT
788
+ commit refs/heads/J
789
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
790
+ data <<COMMIT
791
+ initialize J
792
+ COMMIT
793
781
-INPUT_END
782
-test_expect_success 'J: reset existing branch creates empty commit' '
794
+ INPUT_END
795
git fast-import <input
796
'
797
test_expect_success 'J: branch has 1 commit, empty tree' '
@@ -787,41 +799,42 @@ test_expect_success 'J: branch has 1 commit, empty tree' '
799
test 0 = `git ls-tree J | wc -l`
800
'
801
790
-cat >input <<-INPUT_END &&
791
-reset refs/heads/J2
792
-
793
-tag wrong_tag
794
-from refs/heads/J2
795
-data <<EOF
796
-Tag branch that was reset.
797
-EOF
798
-INPUT_END
802
test_expect_success 'J: tag must fail on empty branch' '
803
+ cat >input <<-INPUT_END &&
804
+ reset refs/heads/J2
805
+
806
+ tag wrong_tag
807
+ from refs/heads/J2
808
+ data <<EOF
809
+ Tag branch that was reset.
810
+ EOF
811
+ INPUT_END
812
test_must_fail git fast-import <input
813
'
814
+
815
###
816
### series K
817
###
818
806
-cat >input <<-INPUT_END &&
807
-commit refs/heads/K
808
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
809
-data <<COMMIT
810
-create K
811
-COMMIT
819
+test_expect_success 'K: reinit branch with from' '
820
+ cat >input <<-INPUT_END &&
821
+ commit refs/heads/K
822
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
823
+ data <<COMMIT
824
+ create K
825
+ COMMIT
826
813
-from refs/heads/branch
827
+ from refs/heads/branch
828
815
-commit refs/heads/K
816
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
817
-data <<COMMIT
818
-redo K
819
-COMMIT
829
+ commit refs/heads/K
830
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
831
+ data <<COMMIT
832
+ redo K
833
+ COMMIT
834
821
-from refs/heads/branch^1
835
+ from refs/heads/branch^1
836
823
-INPUT_END
824
-test_expect_success 'K: reinit branch with from' '
837
+ INPUT_END
838
git fast-import <input
839
'
840
test_expect_success 'K: verify K^1 = branch^1' '
@@ -833,84 +846,84 @@ test_expect_success 'K: verify K^1 = branch^1' '
846
### series L
847
###
848
836
-cat >input <<-INPUT_END &&
837
-blob
838
-mark :1
839
-data <<EOF
840
-some data
841
-EOF
842
-
843
-blob
844
-mark :2
845
-data <<EOF
846
-other data
847
-EOF
848
-
849
-commit refs/heads/L
850
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
851
-data <<COMMIT
852
-create L
853
-COMMIT
854
-
855
-M 644 :1 b.
856
-M 644 :1 b/other
857
-M 644 :1 ba
858
-
859
-commit refs/heads/L
860
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
861
-data <<COMMIT
862
-update L
863
-COMMIT
864
-
865
-M 644 :2 b.
866
-M 644 :2 b/other
867
-M 644 :2 ba
868
-INPUT_END
869
-
870
-cat >expect <<-EXPECT_END &&
871
-:100644 100644 4268632... 55d3a52... M b.
872
-:040000 040000 0ae5cac... 443c768... M b
873
-:100644 100644 4268632... 55d3a52... M ba
874
-EXPECT_END
849
+test_expect_success 'L: verify internal tree sorting' '
850
+ cat >input <<-INPUT_END &&
851
+ blob
852
+ mark :1
853
+ data <<EOF
854
+ some data
855
+ EOF
856
+
857
+ blob
858
+ mark :2
859
+ data <<EOF
860
+ other data
861
+ EOF
862
+
863
+ commit refs/heads/L
864
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
865
+ data <<COMMIT
866
+ create L
867
+ COMMIT
868
+
869
+ M 644 :1 b.
870
+ M 644 :1 b/other
871
+ M 644 :1 ba
872
+
873
+ commit refs/heads/L
874
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
875
+ data <<COMMIT
876
+ update L
877
+ COMMIT
878
+
879
+ M 644 :2 b.
880
+ M 644 :2 b/other
881
+ M 644 :2 ba
882
+ INPUT_END
883
+
884
+ cat >expect <<-EXPECT_END &&
885
+ :100644 100644 4268632... 55d3a52... M b.
886
+ :040000 040000 0ae5cac... 443c768... M b
887
+ :100644 100644 4268632... 55d3a52... M ba
888
+ EXPECT_END
889
+
890
+ git fast-import <input &&
891
+ git diff-tree --abbrev --raw L^ L >output &&
892
+ test_cmp expect output
893
+'
894
+
895
+test_expect_success 'L: nested tree copy does not corrupt deltas' '
896
+ cat >input <<-INPUT_END &&
897
+ blob
898
+ mark :1
899
+ data <<EOF
900
+ the data
901
+ EOF
902
+
903
+ commit refs/heads/L2
904
+ committer C O Mitter <committer@example.com> 1112912473 -0700
905
+ data <<COMMIT
906
+ init L2
907
+ COMMIT
908
+ M 644 :1 a/b/c
909
+ M 644 :1 a/b/d
910
+ M 644 :1 a/e/f
911
876
-test_expect_success 'L: verify internal tree sorting' '
877
- git fast-import <input &&
878
- git diff-tree --abbrev --raw L^ L >output &&
879
- test_cmp expect output
880
-'
912
+ commit refs/heads/L2
913
+ committer C O Mitter <committer@example.com> 1112912473 -0700
914
+ data <<COMMIT
915
+ update L2
916
+ COMMIT
917
+ C a g
918
+ C a/e g/b
919
+ M 644 :1 g/b/h
920
+ INPUT_END
921
882
-cat >input <<-INPUT_END &&
883
-blob
884
-mark :1
885
-data <<EOF
886
-the data
887
-EOF
888
-
889
-commit refs/heads/L2
890
-committer C O Mitter <committer@example.com> 1112912473 -0700
891
-data <<COMMIT
892
-init L2
893
-COMMIT
894
-M 644 :1 a/b/c
895
-M 644 :1 a/b/d
896
-M 644 :1 a/e/f
897
-
898
-commit refs/heads/L2
899
-committer C O Mitter <committer@example.com> 1112912473 -0700
900
-data <<COMMIT
901
-update L2
902
-COMMIT
903
-C a g
904
-C a/e g/b
905
-M 644 :1 g/b/h
906
-INPUT_END
907
-
908
-cat <<-EOF >expect &&
909
-g/b/f
910
-g/b/h
911
-EOF
922
+ cat >expect <<-\EOF &&
923
+ g/b/f
924
+ g/b/h
925
+ EOF
926
913
-test_expect_success 'L: nested tree copy does not corrupt deltas' '
927
test_when_finished "git update-ref -d refs/heads/L2" &&
928
git fast-import <input &&
929
git ls-tree L2 g/b/ >tmp &&
@@ -923,90 +936,90 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
936
### series M
937
###
938
926
-test_tick
927
-cat >input <<-INPUT_END &&
928
-commit refs/heads/M1
929
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
930
-data <<COMMIT
931
-file rename
932
-COMMIT
939
+test_expect_success 'M: rename file in same subdirectory' '
940
+ test_tick &&
941
+ cat >input <<-INPUT_END &&
942
+ commit refs/heads/M1
943
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
944
+ data <<COMMIT
945
+ file rename
946
+ COMMIT
947
934
-from refs/heads/branch^0
935
-R file2/newf file2/n.e.w.f
948
+ from refs/heads/branch^0
949
+ R file2/newf file2/n.e.w.f
950
937
-INPUT_END
951
+ INPUT_END
952
939
-cat >expect <<-EOF &&
940
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
941
-EOF
942
-test_expect_success 'M: rename file in same subdirectory' '
953
+ cat >expect <<-EOF &&
954
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
955
+ EOF
956
git fast-import <input &&
957
git diff-tree -M -r M1^ M1 >actual &&
958
compare_diff_raw expect actual
959
'
960
948
-cat >input <<-INPUT_END &&
949
-commit refs/heads/M2
950
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
951
-data <<COMMIT
952
-file rename
953
-COMMIT
961
+test_expect_success 'M: rename file to new subdirectory' '
962
+ cat >input <<-INPUT_END &&
963
+ commit refs/heads/M2
964
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
965
+ data <<COMMIT
966
+ file rename
967
+ COMMIT
968
955
-from refs/heads/branch^0
956
-R file2/newf i/am/new/to/you
969
+ from refs/heads/branch^0
970
+ R file2/newf i/am/new/to/you
971
958
-INPUT_END
972
+ INPUT_END
973
960
-cat >expect <<-EOF &&
961
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
962
-EOF
963
-test_expect_success 'M: rename file to new subdirectory' '
974
+ cat >expect <<-EOF &&
975
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
976
+ EOF
977
git fast-import <input &&
978
git diff-tree -M -r M2^ M2 >actual &&
979
compare_diff_raw expect actual
980
'
981
969
-cat >input <<-INPUT_END &&
970
-commit refs/heads/M3
971
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
972
-data <<COMMIT
973
-file rename
974
-COMMIT
982
+test_expect_success 'M: rename subdirectory to new subdirectory' '
983
+ cat >input <<-INPUT_END &&
984
+ commit refs/heads/M3
985
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
986
+ data <<COMMIT
987
+ file rename
988
+ COMMIT
989
976
-from refs/heads/M2^0
977
-R i other/sub
990
+ from refs/heads/M2^0
991
+ R i other/sub
992
979
-INPUT_END
993
+ INPUT_END
994
981
-cat >expect <<-EOF &&
982
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
983
-EOF
984
-test_expect_success 'M: rename subdirectory to new subdirectory' '
995
+ cat >expect <<-EOF &&
996
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
997
+ EOF
998
git fast-import <input &&
999
git diff-tree -M -r M3^ M3 >actual &&
1000
compare_diff_raw expect actual
1001
'
1002
990
-cat >input <<-INPUT_END &&
991
-commit refs/heads/M4
992
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
993
-data <<COMMIT
994
-rename root
995
-COMMIT
1003
+test_expect_success 'M: rename root to subdirectory' '
1004
+ cat >input <<-INPUT_END &&
1005
+ commit refs/heads/M4
1006
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1007
+ data <<COMMIT
1008
+ rename root
1009
+ COMMIT
1010
997
-from refs/heads/M2^0
998
-R "" sub
1011
+ from refs/heads/M2^0
1012
+ R "" sub
1013
1000
-INPUT_END
1014
+ INPUT_END
1015
1002
-cat >expect <<-EOF &&
1003
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
1004
-:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
1005
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
1006
-:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
1007
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
1008
-EOF
1009
-test_expect_success 'M: rename root to subdirectory' '
1016
+ cat >expect <<-EOF &&
1017
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2/oldf sub/file2/oldf
1018
+ :100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100 file4 sub/file4
1019
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you sub/i/am/new/to/you
1020
+ :100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100 newdir/exec.sh sub/newdir/exec.sh
1021
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting sub/newdir/interesting
1022
+ EOF
1023
git fast-import <input &&
1024
git diff-tree -M -r M4^ M4 >actual &&
1025
cat actual &&
@@ -1017,81 +1030,81 @@ test_expect_success 'M: rename root to subdirectory' '
1030
### series N
1031
###
1032
1020
-test_tick
1021
-cat >input <<-INPUT_END &&
1022
-commit refs/heads/N1
1023
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1024
-data <<COMMIT
1025
-file copy
1026
-COMMIT
1033
+test_expect_success 'N: copy file in same subdirectory' '
1034
+ test_tick &&
1035
+ cat >input <<-INPUT_END &&
1036
+ commit refs/heads/N1
1037
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1038
+ data <<COMMIT
1039
+ file copy
1040
+ COMMIT
1041
1028
-from refs/heads/branch^0
1029
-C file2/newf file2/n.e.w.f
1042
+ from refs/heads/branch^0
1043
+ C file2/newf file2/n.e.w.f
1044
1031
-INPUT_END
1045
+ INPUT_END
1046
1033
-cat >expect <<-EOF &&
1034
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1035
-EOF
1036
-test_expect_success 'N: copy file in same subdirectory' '
1047
+ cat >expect <<-EOF &&
1048
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
1049
+ EOF
1050
git fast-import <input &&
1051
git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
1052
compare_diff_raw expect actual
1053
'
1054
1042
-cat >input <<-INPUT_END &&
1043
-commit refs/heads/N2
1044
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1045
-data <<COMMIT
1046
-clean directory copy
1047
-COMMIT
1055
+test_expect_success 'N: copy then modify subdirectory' '
1056
+ cat >input <<-INPUT_END &&
1057
+ commit refs/heads/N2
1058
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1059
+ data <<COMMIT
1060
+ clean directory copy
1061
+ COMMIT
1062
1049
-from refs/heads/branch^0
1050
-C file2 file3
1063
+ from refs/heads/branch^0
1064
+ C file2 file3
1065
1052
-commit refs/heads/N2
1053
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1054
-data <<COMMIT
1055
-modify directory copy
1056
-COMMIT
1066
+ commit refs/heads/N2
1067
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1068
+ data <<COMMIT
1069
+ modify directory copy
1070
+ COMMIT
1071
1058
-M 644 inline file3/file5
1059
-data <<EOF
1060
-$file5_data
1061
-EOF
1072
+ M 644 inline file3/file5
1073
+ data <<EOF
1074
+ $file5_data
1075
+ EOF
1076
1063
-INPUT_END
1077
+ INPUT_END
1078
1065
-cat >expect <<-EOF &&
1066
-:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1067
-:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1068
-:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1069
-EOF
1070
-test_expect_success 'N: copy then modify subdirectory' '
1079
+ cat >expect <<-EOF &&
1080
+ :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
1081
+ :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
1082
+ :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
1083
+ EOF
1084
git fast-import <input &&
1085
git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
1086
compare_diff_raw expect actual
1087
'
1088
1076
-cat >input <<-INPUT_END &&
1077
-commit refs/heads/N3
1078
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1079
-data <<COMMIT
1080
-dirty directory copy
1081
-COMMIT
1089
+test_expect_success 'N: copy dirty subdirectory' '
1090
+ cat >input <<-INPUT_END &&
1091
+ commit refs/heads/N3
1092
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1093
+ data <<COMMIT
1094
+ dirty directory copy
1095
+ COMMIT
1096
1083
-from refs/heads/branch^0
1084
-M 644 inline file2/file5
1085
-data <<EOF
1086
-$file5_data
1087
-EOF
1097
+ from refs/heads/branch^0
1098
+ M 644 inline file2/file5
1099
+ data <<EOF
1100
+ $file5_data
1101
+ EOF
1102
1089
-C file2 file3
1090
-D file2/file5
1103
+ C file2 file3
1104
+ D file2/file5
1105
1092
-INPUT_END
1106
+ INPUT_END
1107
1094
-test_expect_success 'N: copy dirty subdirectory' '
1108
git fast-import <input &&
1109
test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`
1110
'
@@ -1457,59 +1470,59 @@ test_expect_success 'N: modify subtree, extract it, and modify again' '
1470
### series O
1471
###
1472
1460
-cat >input <<-INPUT_END &&
1461
-#we will
1462
-commit refs/heads/O1
1463
-# -- ignore all of this text
1464
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1465
-# $GIT_COMMITTER_NAME has inserted here for his benefit.
1466
-data <<COMMIT
1467
-dirty directory copy
1468
-COMMIT
1469
-
1470
-# don't forget the import blank line!
1471
-#
1472
-# yes, we started from our usual base of branch^0.
1473
-# i like branch^0.
1474
-from refs/heads/branch^0
1475
-# and we need to reuse file2/file5 from N3 above.
1476
-M 644 inline file2/file5
1477
-# otherwise the tree will be different
1478
-data <<EOF
1479
-$file5_data
1480
-EOF
1481
-
1482
-# don't forget to copy file2 to file3
1483
-C file2 file3
1484
-#
1485
-# or to delete file5 from file2.
1486
-D file2/file5
1487
-# are we done yet?
1473
+test_expect_success 'O: comments are all skipped' '
1474
+ cat >input <<-INPUT_END &&
1475
+ #we will
1476
+ commit refs/heads/O1
1477
+ # -- ignore all of this text
1478
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1479
+ # $GIT_COMMITTER_NAME has inserted here for his benefit.
1480
+ data <<COMMIT
1481
+ dirty directory copy
1482
+ COMMIT
1483
+
1484
+ # do not forget the import blank line!
1485
+ #
1486
+ # yes, we started from our usual base of branch^0.
1487
+ # i like branch^0.
1488
+ from refs/heads/branch^0
1489
+ # and we need to reuse file2/file5 from N3 above.
1490
+ M 644 inline file2/file5
1491
+ # otherwise the tree will be different
1492
+ data <<EOF
1493
+ $file5_data
1494
+ EOF
1495
1489
-INPUT_END
1496
+ # do not forget to copy file2 to file3
1497
+ C file2 file3
1498
+ #
1499
+ # or to delete file5 from file2.
1500
+ D file2/file5
1501
+ # are we done yet?
1502
+
1503
+ INPUT_END
1504
1491
-test_expect_success 'O: comments are all skipped' '
1505
git fast-import <input &&
1506
test `git rev-parse N3` = `git rev-parse O1`
1507
'
1508
1496
-cat >input <<-INPUT_END &&
1497
-commit refs/heads/O2
1498
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1499
-data <<COMMIT
1500
-dirty directory copy
1501
-COMMIT
1502
-from refs/heads/branch^0
1503
-M 644 inline file2/file5
1504
-data <<EOF
1505
-$file5_data
1506
-EOF
1507
-C file2 file3
1508
-D file2/file5
1509
+test_expect_success 'O: blank lines not necessary after data commands' '
1510
+ cat >input <<-INPUT_END &&
1511
+ commit refs/heads/O2
1512
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1513
+ data <<COMMIT
1514
+ dirty directory copy
1515
+ COMMIT
1516
+ from refs/heads/branch^0
1517
+ M 644 inline file2/file5
1518
+ data <<EOF
1519
+ $file5_data
1520
+ EOF
1521
+ C file2 file3
1522
+ D file2/file5
1523
1510
-INPUT_END
1524
+ INPUT_END
1525
1512
-test_expect_success 'O: blank lines not necessary after data commands' '
1526
git fast-import <input &&
1527
test `git rev-parse N3` = `git rev-parse O2`
1528
'
@@ -1518,43 +1531,44 @@ test_expect_success 'O: repack before next test' '
1531
git repack -a -d
1532
'
1533
1521
-cat >input <<-INPUT_END &&
1522
-commit refs/heads/O3
1523
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1524
-data <<COMMIT
1525
-zstring
1526
-COMMIT
1527
-commit refs/heads/O3
1528
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1529
-data <<COMMIT
1530
-zof
1531
-COMMIT
1532
-checkpoint
1533
-commit refs/heads/O3
1534
-mark :5
1535
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1536
-data <<COMMIT
1537
-zempty
1538
-COMMIT
1539
-checkpoint
1540
-commit refs/heads/O3
1541
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1542
-data <<COMMIT
1543
-zcommits
1544
-COMMIT
1545
-reset refs/tags/O3-2nd
1546
-from :5
1547
-reset refs/tags/O3-3rd
1548
-from :5
1549
-INPUT_END
1550
-
1551
-cat >expect <<-INPUT_END &&
1552
-string
1553
-of
1554
-empty
1555
-commits
1556
-INPUT_END
1534
test_expect_success 'O: blank lines not necessary after other commands' '
1535
+ cat >input <<-INPUT_END &&
1536
+ commit refs/heads/O3
1537
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1538
+ data <<COMMIT
1539
+ zstring
1540
+ COMMIT
1541
+ commit refs/heads/O3
1542
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1543
+ data <<COMMIT
1544
+ zof
1545
+ COMMIT
1546
+ checkpoint
1547
+ commit refs/heads/O3
1548
+ mark :5
1549
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1550
+ data <<COMMIT
1551
+ zempty
1552
+ COMMIT
1553
+ checkpoint
1554
+ commit refs/heads/O3
1555
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1556
+ data <<COMMIT
1557
+ zcommits
1558
+ COMMIT
1559
+ reset refs/tags/O3-2nd
1560
+ from :5
1561
+ reset refs/tags/O3-3rd
1562
+ from :5
1563
+ INPUT_END
1564
+
1565
+ cat >expect <<-INPUT_END &&
1566
+ string
1567
+ of
1568
+ empty
1569
+ commits
1570
+ INPUT_END
1571
+
1572
git fast-import <input &&
1573
test 8 = `find .git/objects/pack -type f | wc -l` &&
1574
test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
@@ -1562,319 +1576,319 @@ test_expect_success 'O: blank lines not necessary after other commands' '
1576
test_cmp expect actual
1577
'
1578
1565
-cat >input <<-INPUT_END &&
1566
-commit refs/heads/O4
1567
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1568
-data <<COMMIT
1569
-zstring
1570
-COMMIT
1571
-commit refs/heads/O4
1572
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1573
-data <<COMMIT
1574
-zof
1575
-COMMIT
1576
-progress Two commits down, 2 to go!
1577
-commit refs/heads/O4
1578
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1579
-data <<COMMIT
1580
-zempty
1581
-COMMIT
1582
-progress Three commits down, 1 to go!
1583
-commit refs/heads/O4
1584
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1585
-data <<COMMIT
1586
-zcommits
1587
-COMMIT
1588
-progress I'm done!
1589
-INPUT_END
1579
test_expect_success 'O: progress outputs as requested by input' '
1580
+ cat >input <<-INPUT_END &&
1581
+ commit refs/heads/O4
1582
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1583
+ data <<COMMIT
1584
+ zstring
1585
+ COMMIT
1586
+ commit refs/heads/O4
1587
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1588
+ data <<COMMIT
1589
+ zof
1590
+ COMMIT
1591
+ progress Two commits down, 2 to go!
1592
+ commit refs/heads/O4
1593
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1594
+ data <<COMMIT
1595
+ zempty
1596
+ COMMIT
1597
+ progress Three commits down, 1 to go!
1598
+ commit refs/heads/O4
1599
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1600
+ data <<COMMIT
1601
+ zcommits
1602
+ COMMIT
1603
+ progress done!
1604
+ INPUT_END
1605
git fast-import <input >actual &&
1606
grep "progress " <input >expect &&
1607
test_cmp expect actual
1608
'
1609
1596
-###
1597
-### series P (gitlinks)
1598
-###
1610
+###
1611
+### series P (gitlinks)
1612
+###
1613
+
1614
+test_expect_success 'P: superproject & submodule mix' '
1615
+ cat >input <<-INPUT_END &&
1616
+ blob
1617
+ mark :1
1618
+ data 10
1619
+ test file
1620
+
1621
+ reset refs/heads/sub
1622
+ commit refs/heads/sub
1623
+ mark :2
1624
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1625
+ data 12
1626
+ sub_initial
1627
+ M 100644 :1 file
1628
+
1629
+ blob
1630
+ mark :3
1631
+ data <<DATAEND
1632
+ [submodule "sub"]
1633
+ path = sub
1634
+ url = "`pwd`/sub"
1635
+ DATAEND
1636
+
1637
+ commit refs/heads/subuse1
1638
+ mark :4
1639
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1640
+ data 8
1641
+ initial
1642
+ from refs/heads/master
1643
+ M 100644 :3 .gitmodules
1644
+ M 160000 :2 sub
1645
+
1646
+ blob
1647
+ mark :5
1648
+ data 20
1649
+ test file
1650
+ more data
1651
+
1652
+ commit refs/heads/sub
1653
+ mark :6
1654
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1655
+ data 11
1656
+ sub_second
1657
+ from :2
1658
+ M 100644 :5 file
1659
+
1660
+ commit refs/heads/subuse1
1661
+ mark :7
1662
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1663
+ data 7
1664
+ second
1665
+ from :4
1666
+ M 160000 :6 sub
1667
+
1668
+ INPUT_END
1669
+
1670
+ git fast-import <input &&
1671
+ git checkout subuse1 &&
1672
+ rm -rf sub &&
1673
+ mkdir sub &&
1674
+ (
1675
+ cd sub &&
1676
+ git init &&
1677
+ git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1678
+ git checkout master
1679
+ ) &&
1680
+ git submodule init &&
1681
+ git submodule update
1682
+'
1683
+
1684
+test_expect_success 'P: verbatim SHA gitlinks' '
1685
+ SUBLAST=$(git rev-parse --verify sub) &&
1686
+ SUBPREV=$(git rev-parse --verify sub^) &&
1687
+
1688
+ cat >input <<-INPUT_END &&
1689
+ blob
1690
+ mark :1
1691
+ data <<DATAEND
1692
+ [submodule "sub"]
1693
+ path = sub
1694
+ url = "`pwd`/sub"
1695
+ DATAEND
1696
+
1697
+ commit refs/heads/subuse2
1698
+ mark :2
1699
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1700
+ data 8
1701
+ initial
1702
+ from refs/heads/master
1703
+ M 100644 :1 .gitmodules
1704
+ M 160000 $SUBPREV sub
1705
+
1706
+ commit refs/heads/subuse2
1707
+ mark :3
1708
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1709
+ data 7
1710
+ second
1711
+ from :2
1712
+ M 160000 $SUBLAST sub
1713
+
1714
+ INPUT_END
1715
+
1716
+ git branch -D sub &&
1717
+ git gc &&
1718
+ git prune &&
1719
+ git fast-import <input &&
1720
+ test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
1721
+'
1722
+
1723
+test_expect_success 'P: fail on inline gitlink' '
1724
+ test_tick &&
1725
+ cat >input <<-INPUT_END &&
1726
+ commit refs/heads/subuse3
1727
+ mark :1
1728
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1729
+ data <<COMMIT
1730
+ corrupt
1731
+ COMMIT
1732
+
1733
+ from refs/heads/subuse2
1734
+ M 160000 inline sub
1735
+ data <<DATA
1736
+ $SUBPREV
1737
+ DATA
1738
+
1739
+ INPUT_END
1740
+
1741
+ test_must_fail git fast-import <input
1742
+'
1743
+
1744
+test_expect_success 'P: fail on blob mark in gitlink' '
1745
+ test_tick &&
1746
+ cat >input <<-INPUT_END &&
1747
+ blob
1748
+ mark :1
1749
+ data <<DATA
1750
+ $SUBPREV
1751
+ DATA
1752
+
1753
+ commit refs/heads/subuse3
1754
+ mark :2
1755
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1756
+ data <<COMMIT
1757
+ corrupt
1758
+ COMMIT
1759
+
1760
+ from refs/heads/subuse2
1761
+ M 160000 :1 sub
1762
+
1763
+ INPUT_END
1764
+
1765
+ test_must_fail git fast-import <input
1766
+'
1767
+
1768
+###
1769
+### series Q (notes)
1770
+###
1771
+
1772
+test_expect_success 'Q: commit notes' '
1773
+ note1_data="The first note for the first commit" &&
1774
+ note2_data="The first note for the second commit" &&
1775
+ note3_data="The first note for the third commit" &&
1776
+ note1b_data="The second note for the first commit" &&
1777
+ note1c_data="The third note for the first commit" &&
1778
+ note2b_data="The second note for the second commit" &&
1779
+
1780
+ test_tick &&
1781
+ cat >input <<-INPUT_END &&
1782
+ blob
1783
+ mark :2
1784
+ data <<EOF
1785
+ $file2_data
1786
+ EOF
1787
+
1788
+ commit refs/heads/notes-test
1789
+ mark :3
1790
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1791
+ data <<COMMIT
1792
+ first (:3)
1793
+ COMMIT
1794
+
1795
+ M 644 :2 file2
1796
1600
-cat >input <<-INPUT_END &&
1601
-blob
1602
-mark :1
1603
-data 10
1604
-test file
1605
-
1606
-reset refs/heads/sub
1607
-commit refs/heads/sub
1608
-mark :2
1609
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1610
-data 12
1611
-sub_initial
1612
-M 100644 :1 file
1613
-
1614
-blob
1615
-mark :3
1616
-data <<DATAEND
1617
-[submodule "sub"]
1618
- path = sub
1619
- url = "`pwd`/sub"
1620
-DATAEND
1621
-
1622
-commit refs/heads/subuse1
1623
-mark :4
1624
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1625
-data 8
1626
-initial
1627
-from refs/heads/master
1628
-M 100644 :3 .gitmodules
1629
-M 160000 :2 sub
1630
-
1631
-blob
1632
-mark :5
1633
-data 20
1634
-test file
1635
-more data
1636
-
1637
-commit refs/heads/sub
1638
-mark :6
1639
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1640
-data 11
1641
-sub_second
1642
-from :2
1643
-M 100644 :5 file
1644
-
1645
-commit refs/heads/subuse1
1646
-mark :7
1647
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1648
-data 7
1649
-second
1650
-from :4
1651
-M 160000 :6 sub
1652
-
1653
-INPUT_END
1797
+ blob
1798
+ mark :4
1799
+ data $file4_len
1800
+ $file4_data
1801
+ commit refs/heads/notes-test
1802
+ mark :5
1803
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1804
+ data <<COMMIT
1805
+ second (:5)
1806
+ COMMIT
1807
1655
-test_expect_success 'P: superproject & submodule mix' '
1656
- git fast-import <input &&
1657
- git checkout subuse1 &&
1658
- rm -rf sub &&
1659
- mkdir sub &&
1660
- (
1661
- cd sub &&
1662
- git init &&
1663
- git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1664
- git checkout master
1665
- ) &&
1666
- git submodule init &&
1667
- git submodule update
1668
-'
1808
+ M 644 :4 file4
1809
1670
-SUBLAST=$(git rev-parse --verify sub)
1671
-SUBPREV=$(git rev-parse --verify sub^)
1672
-
1673
-cat >input <<-INPUT_END &&
1674
-blob
1675
-mark :1
1676
-data <<DATAEND
1677
-[submodule "sub"]
1678
- path = sub
1679
- url = "`pwd`/sub"
1680
-DATAEND
1681
-
1682
-commit refs/heads/subuse2
1683
-mark :2
1684
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1685
-data 8
1686
-initial
1687
-from refs/heads/master
1688
-M 100644 :1 .gitmodules
1689
-M 160000 $SUBPREV sub
1690
-
1691
-commit refs/heads/subuse2
1692
-mark :3
1693
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1694
-data 7
1695
-second
1696
-from :2
1697
-M 160000 $SUBLAST sub
1698
-
1699
-INPUT_END
1810
+ commit refs/heads/notes-test
1811
+ mark :6
1812
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1813
+ data <<COMMIT
1814
+ third (:6)
1815
+ COMMIT
1816
1701
-test_expect_success 'P: verbatim SHA gitlinks' '
1702
- git branch -D sub &&
1703
- git gc &&
1704
- git prune &&
1705
- git fast-import <input &&
1706
- test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
1707
-'
1817
+ M 644 inline file5
1818
+ data <<EOF
1819
+ $file5_data
1820
+ EOF
1821
1709
-test_tick
1710
-cat >input <<-INPUT_END &&
1711
-commit refs/heads/subuse3
1712
-mark :1
1713
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1714
-data <<COMMIT
1715
-corrupt
1716
-COMMIT
1822
+ M 755 inline file6
1823
+ data <<EOF
1824
+ $file6_data
1825
+ EOF
1826
1718
-from refs/heads/subuse2
1719
-M 160000 inline sub
1720
-data <<DATA
1721
-$SUBPREV
1722
-DATA
1827
+ blob
1828
+ mark :7
1829
+ data <<EOF
1830
+ $note1_data
1831
+ EOF
1832
1724
-INPUT_END
1833
+ blob
1834
+ mark :8
1835
+ data <<EOF
1836
+ $note2_data
1837
+ EOF
1838
1726
-test_expect_success 'P: fail on inline gitlink' '
1727
- test_must_fail git fast-import <input
1728
-'
1839
+ commit refs/notes/foobar
1840
+ mark :9
1841
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1842
+ data <<COMMIT
1843
+ notes (:9)
1844
+ COMMIT
1845
1730
-test_tick
1731
-cat >input <<-INPUT_END &&
1732
-blob
1733
-mark :1
1734
-data <<DATA
1735
-$SUBPREV
1736
-DATA
1846
+ N :7 :3
1847
+ N :8 :5
1848
+ N inline :6
1849
+ data <<EOF
1850
+ $note3_data
1851
+ EOF
1852
1738
-commit refs/heads/subuse3
1739
-mark :2
1740
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1741
-data <<COMMIT
1742
-corrupt
1743
-COMMIT
1853
+ commit refs/notes/foobar
1854
+ mark :10
1855
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1856
+ data <<COMMIT
1857
+ notes (:10)
1858
+ COMMIT
1859
1745
-from refs/heads/subuse2
1746
-M 160000 :1 sub
1860
+ N inline :3
1861
+ data <<EOF
1862
+ $note1b_data
1863
+ EOF
1864
1748
-INPUT_END
1865
+ commit refs/notes/foobar2
1866
+ mark :11
1867
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1868
+ data <<COMMIT
1869
+ notes (:11)
1870
+ COMMIT
1871
1750
-test_expect_success 'P: fail on blob mark in gitlink' '
1751
- test_must_fail git fast-import <input
1752
-'
1872
+ N inline :3
1873
+ data <<EOF
1874
+ $note1c_data
1875
+ EOF
1876
1754
-###
1755
-### series Q (notes)
1756
-###
1877
+ commit refs/notes/foobar
1878
+ mark :12
1879
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1880
+ data <<COMMIT
1881
+ notes (:12)
1882
+ COMMIT
1883
+
1884
+ deleteall
1885
+ N inline :5
1886
+ data <<EOF
1887
+ $note2b_data
1888
+ EOF
1889
1758
-note1_data="The first note for the first commit"
1759
-note2_data="The first note for the second commit"
1760
-note3_data="The first note for the third commit"
1761
-note1b_data="The second note for the first commit"
1762
-note1c_data="The third note for the first commit"
1763
-note2b_data="The second note for the second commit"
1764
-
1765
-test_tick
1766
-cat >input <<-INPUT_END &&
1767
-blob
1768
-mark :2
1769
-data <<EOF
1770
-$file2_data
1771
-EOF
1772
-
1773
-commit refs/heads/notes-test
1774
-mark :3
1775
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1776
-data <<COMMIT
1777
-first (:3)
1778
-COMMIT
1779
-
1780
-M 644 :2 file2
1781
-
1782
-blob
1783
-mark :4
1784
-data $file4_len
1785
-$file4_data
1786
-commit refs/heads/notes-test
1787
-mark :5
1788
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1789
-data <<COMMIT
1790
-second (:5)
1791
-COMMIT
1792
-
1793
-M 644 :4 file4
1794
-
1795
-commit refs/heads/notes-test
1796
-mark :6
1797
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1798
-data <<COMMIT
1799
-third (:6)
1800
-COMMIT
1801
-
1802
-M 644 inline file5
1803
-data <<EOF
1804
-$file5_data
1805
-EOF
1806
-
1807
-M 755 inline file6
1808
-data <<EOF
1809
-$file6_data
1810
-EOF
1811
-
1812
-blob
1813
-mark :7
1814
-data <<EOF
1815
-$note1_data
1816
-EOF
1817
-
1818
-blob
1819
-mark :8
1820
-data <<EOF
1821
-$note2_data
1822
-EOF
1823
-
1824
-commit refs/notes/foobar
1825
-mark :9
1826
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1827
-data <<COMMIT
1828
-notes (:9)
1829
-COMMIT
1830
-
1831
-N :7 :3
1832
-N :8 :5
1833
-N inline :6
1834
-data <<EOF
1835
-$note3_data
1836
-EOF
1837
-
1838
-commit refs/notes/foobar
1839
-mark :10
1840
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1841
-data <<COMMIT
1842
-notes (:10)
1843
-COMMIT
1844
-
1845
-N inline :3
1846
-data <<EOF
1847
-$note1b_data
1848
-EOF
1849
-
1850
-commit refs/notes/foobar2
1851
-mark :11
1852
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1853
-data <<COMMIT
1854
-notes (:11)
1855
-COMMIT
1856
-
1857
-N inline :3
1858
-data <<EOF
1859
-$note1c_data
1860
-EOF
1861
-
1862
-commit refs/notes/foobar
1863
-mark :12
1864
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1865
-data <<COMMIT
1866
-notes (:12)
1867
-COMMIT
1868
-
1869
-deleteall
1870
-N inline :5
1871
-data <<EOF
1872
-$note2b_data
1873
-EOF
1874
-
1875
-INPUT_END
1890
+ INPUT_END
1891
1877
-test_expect_success 'Q: commit notes' '
1892
git fast-import <input &&
1893
git whatchanged notes-test
1894
'
@@ -1883,246 +1897,246 @@ test_expect_success 'Q: verify pack' '
1897
verify_packs
1898
'
1899
1886
-commit1=$(git rev-parse notes-test~2)
1887
-commit2=$(git rev-parse notes-test^)
1888
-commit3=$(git rev-parse notes-test)
1900
+test_expect_success 'Q: verify first commit' '
1901
+ commit1=$(git rev-parse notes-test~2) &&
1902
+ commit2=$(git rev-parse notes-test^) &&
1903
+ commit3=$(git rev-parse notes-test) &&
1904
1890
-cat >expect <<-EOF &&
1891
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1892
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1905
+ cat >expect <<-EOF &&
1906
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1907
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1908
1894
-first (:3)
1895
-EOF
1896
-test_expect_success 'Q: verify first commit' '
1909
+ first (:3)
1910
+ EOF
1911
git cat-file commit notes-test~2 | sed 1d >actual &&
1912
test_cmp expect actual
1913
'
1914
1901
-cat >expect <<-EOF &&
1902
-parent $commit1
1903
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1904
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1905
-
1906
-second (:5)
1907
-EOF
1915
test_expect_success 'Q: verify second commit' '
1916
+ cat >expect <<-EOF &&
1917
+ parent $commit1
1918
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1919
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1920
+
1921
+ second (:5)
1922
+ EOF
1923
git cat-file commit notes-test^ | sed 1d >actual &&
1924
test_cmp expect actual
1925
'
1926
1913
-cat >expect <<-EOF &&
1914
-parent $commit2
1915
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1916
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1917
-
1918
-third (:6)
1919
-EOF
1927
test_expect_success 'Q: verify third commit' '
1928
+ cat >expect <<-EOF &&
1929
+ parent $commit2
1930
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1931
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1932
+
1933
+ third (:6)
1934
+ EOF
1935
git cat-file commit notes-test | sed 1d >actual &&
1936
test_cmp expect actual
1937
'
1938
1925
-cat >expect <<-EOF &&
1926
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1927
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1928
-
1929
-notes (:9)
1930
-EOF
1939
test_expect_success 'Q: verify first notes commit' '
1940
+ cat >expect <<-EOF &&
1941
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1942
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1943
+
1944
+ notes (:9)
1945
+ EOF
1946
git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
1947
test_cmp expect actual
1948
'
1949
1936
-cat >expect.unsorted <<-EOF &&
1937
-100644 blob $commit1
1938
-100644 blob $commit2
1939
-100644 blob $commit3
1940
-EOF
1941
-cat expect.unsorted | sort >expect
1950
test_expect_success 'Q: verify first notes tree' '
1951
+ cat >expect.unsorted <<-EOF &&
1952
+ 100644 blob $commit1
1953
+ 100644 blob $commit2
1954
+ 100644 blob $commit3
1955
+ EOF
1956
+ cat expect.unsorted | sort >expect &&
1957
git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1958
test_cmp expect actual
1959
'
1960
1947
-echo "$note1_data" >expect
1961
test_expect_success 'Q: verify first note for first commit' '
1962
+ echo "$note1_data" >expect &&
1963
git cat-file blob refs/notes/foobar~2:$commit1 >actual &&
1964
test_cmp expect actual
1965
'
1966
1953
-echo "$note2_data" >expect
1967
test_expect_success 'Q: verify first note for second commit' '
1968
+ echo "$note2_data" >expect &&
1969
git cat-file blob refs/notes/foobar~2:$commit2 >actual &&
1970
test_cmp expect actual
1971
'
1972
1959
-echo "$note3_data" >expect
1973
test_expect_success 'Q: verify first note for third commit' '
1974
+ echo "$note3_data" >expect &&
1975
git cat-file blob refs/notes/foobar~2:$commit3 >actual &&
1976
test_cmp expect actual
1977
'
1978
1965
-cat >expect <<-EOF &&
1966
-parent `git rev-parse --verify refs/notes/foobar~2`
1967
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1968
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1969
-
1970
-notes (:10)
1971
-EOF
1979
test_expect_success 'Q: verify second notes commit' '
1980
+ cat >expect <<-EOF &&
1981
+ parent `git rev-parse --verify refs/notes/foobar~2`
1982
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1983
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
1984
+
1985
+ notes (:10)
1986
+ EOF
1987
git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
1988
test_cmp expect actual
1989
'
1990
1977
-cat >expect.unsorted <<-EOF &&
1978
-100644 blob $commit1
1979
-100644 blob $commit2
1980
-100644 blob $commit3
1981
-EOF
1982
-cat expect.unsorted | sort >expect
1991
test_expect_success 'Q: verify second notes tree' '
1992
+ cat >expect.unsorted <<-EOF &&
1993
+ 100644 blob $commit1
1994
+ 100644 blob $commit2
1995
+ 100644 blob $commit3
1996
+ EOF
1997
+ cat expect.unsorted | sort >expect &&
1998
git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
1999
test_cmp expect actual
2000
'
2001
1988
-echo "$note1b_data" >expect
2002
test_expect_success 'Q: verify second note for first commit' '
2003
+ echo "$note1b_data" >expect &&
2004
git cat-file blob refs/notes/foobar^:$commit1 >actual &&
2005
test_cmp expect actual
2006
'
2007
1994
-echo "$note2_data" >expect
2008
test_expect_success 'Q: verify first note for second commit' '
2009
+ echo "$note2_data" >expect &&
2010
git cat-file blob refs/notes/foobar^:$commit2 >actual &&
2011
test_cmp expect actual
2012
'
2013
2000
-echo "$note3_data" >expect
2014
test_expect_success 'Q: verify first note for third commit' '
2015
+ echo "$note3_data" >expect &&
2016
git cat-file blob refs/notes/foobar^:$commit3 >actual &&
2017
test_cmp expect actual
2018
'
2019
2006
-cat >expect <<-EOF &&
2007
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2008
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2009
-
2010
-notes (:11)
2011
-EOF
2020
test_expect_success 'Q: verify third notes commit' '
2021
+ cat >expect <<-EOF &&
2022
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2023
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2024
+
2025
+ notes (:11)
2026
+ EOF
2027
git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
2028
test_cmp expect actual
2029
'
2030
2017
-cat >expect.unsorted <<-EOF &&
2018
-100644 blob $commit1
2019
-EOF
2020
-cat expect.unsorted | sort >expect
2031
test_expect_success 'Q: verify third notes tree' '
2032
+ cat >expect.unsorted <<-EOF &&
2033
+ 100644 blob $commit1
2034
+ EOF
2035
+ cat expect.unsorted | sort >expect &&
2036
git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2037
test_cmp expect actual
2038
'
2039
2026
-echo "$note1c_data" >expect
2040
test_expect_success 'Q: verify third note for first commit' '
2041
+ echo "$note1c_data" >expect &&
2042
git cat-file blob refs/notes/foobar2:$commit1 >actual &&
2043
test_cmp expect actual
2044
'
2045
2032
-cat >expect <<-EOF &&
2033
-parent `git rev-parse --verify refs/notes/foobar^`
2034
-author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2035
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2036
-
2037
-notes (:12)
2038
-EOF
2046
test_expect_success 'Q: verify fourth notes commit' '
2047
+ cat >expect <<-EOF &&
2048
+ parent `git rev-parse --verify refs/notes/foobar^`
2049
+ author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2050
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2051
+
2052
+ notes (:12)
2053
+ EOF
2054
git cat-file commit refs/notes/foobar | sed 1d >actual &&
2055
test_cmp expect actual
2056
'
2057
2044
-cat >expect.unsorted <<-EOF &&
2045
-100644 blob $commit2
2046
-EOF
2047
-cat expect.unsorted | sort >expect
2058
test_expect_success 'Q: verify fourth notes tree' '
2059
+ cat >expect.unsorted <<-EOF &&
2060
+ 100644 blob $commit2
2061
+ EOF
2062
+ cat expect.unsorted | sort >expect &&
2063
git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
2064
test_cmp expect actual
2065
'
2066
2053
-echo "$note2b_data" >expect
2067
test_expect_success 'Q: verify second note for second commit' '
2068
+ echo "$note2b_data" >expect &&
2069
git cat-file blob refs/notes/foobar:$commit2 >actual &&
2070
test_cmp expect actual
2071
'
2072
2059
-cat >input <<-EOF &&
2060
-reset refs/heads/Q0
2073
+test_expect_success 'Q: deny note on empty branch' '
2074
+ cat >input <<-EOF &&
2075
+ reset refs/heads/Q0
2076
2062
-commit refs/heads/note-Q0
2063
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2064
-data <<COMMIT
2065
-Note for an empty branch.
2066
-COMMIT
2077
+ commit refs/heads/note-Q0
2078
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2079
+ data <<COMMIT
2080
+ Note for an empty branch.
2081
+ COMMIT
2082
2068
-N inline refs/heads/Q0
2069
-data <<NOTE
2070
-some note
2071
-NOTE
2072
-EOF
2073
-test_expect_success 'Q: deny note on empty branch' '
2083
+ N inline refs/heads/Q0
2084
+ data <<NOTE
2085
+ some note
2086
+ NOTE
2087
+ EOF
2088
test_must_fail git fast-import <input
2089
'
2090
###
2091
### series R (feature and option)
2092
###
2093
2080
-cat >input <<-EOF &&
2081
-feature no-such-feature-exists
2082
-EOF
2083
-
2094
test_expect_success 'R: abort on unsupported feature' '
2095
+ cat >input <<-EOF &&
2096
+ feature no-such-feature-exists
2097
+ EOF
2098
+
2099
test_must_fail git fast-import <input
2100
'
2101
2088
-cat >input <<-EOF &&
2089
-feature date-format=now
2090
-EOF
2091
-
2102
test_expect_success 'R: supported feature is accepted' '
2103
+ cat >input <<-EOF &&
2104
+ feature date-format=now
2105
+ EOF
2106
+
2107
git fast-import <input
2108
'
2109
2096
-cat >input <<-EOF &&
2097
-blob
2098
-data 3
2099
-hi
2100
-feature date-format=now
2101
-EOF
2102
-
2110
test_expect_success 'R: abort on receiving feature after data command' '
2111
+ cat >input <<-EOF &&
2112
+ blob
2113
+ data 3
2114
+ hi
2115
+ feature date-format=now
2116
+ EOF
2117
+
2118
test_must_fail git fast-import <input
2119
'
2120
2107
-cat >input <<-EOF &&
2108
-feature import-marks=git.marks
2109
-feature import-marks=git2.marks
2110
-EOF
2111
-
2121
test_expect_success 'R: only one import-marks feature allowed per stream' '
2122
+ cat >input <<-EOF &&
2123
+ feature import-marks=git.marks
2124
+ feature import-marks=git2.marks
2125
+ EOF
2126
+
2127
test_must_fail git fast-import <input
2128
'
2129
2116
-cat >input <<-EOF &&
2117
-feature export-marks=git.marks
2118
-blob
2119
-mark :1
2120
-data 3
2121
-hi
2130
+test_expect_success 'R: export-marks feature results in a marks file being created' '
2131
+ cat >input <<-EOF &&
2132
+ feature export-marks=git.marks
2133
+ blob
2134
+ mark :1
2135
+ data 3
2136
+ hi
2137
2123
-EOF
2138
+ EOF
2139
2125
-test_expect_success 'R: export-marks feature results in a marks file being created' '
2140
cat input | git fast-import &&
2141
grep :1 git.marks
2142
'
@@ -2234,60 +2248,60 @@ test_expect_success 'R: feature import-marks-if-exists' '
2248
test_cmp expect io.marks
2249
'
2250
2237
-cat >input <<-EOF &&
2238
-feature import-marks=marks.out
2239
-feature export-marks=marks.new
2240
-EOF
2241
-
2251
test_expect_success 'R: import to output marks works without any content' '
2252
+ cat >input <<-EOF &&
2253
+ feature import-marks=marks.out
2254
+ feature export-marks=marks.new
2255
+ EOF
2256
+
2257
cat input | git fast-import &&
2258
test_cmp marks.out marks.new
2259
'
2260
2247
-cat >input <<-EOF &&
2248
-feature import-marks=nonexistent.marks
2249
-feature export-marks=marks.new
2250
-EOF
2251
-
2261
test_expect_success 'R: import marks prefers commandline marks file over the stream' '
2262
+ cat >input <<-EOF &&
2263
+ feature import-marks=nonexistent.marks
2264
+ feature export-marks=marks.new
2265
+ EOF
2266
+
2267
cat input | git fast-import --import-marks=marks.out &&
2268
test_cmp marks.out marks.new
2269
'
2270
2271
2258
-cat >input <<-EOF &&
2259
-feature import-marks=nonexistent.marks
2260
-feature export-marks=combined.marks
2261
-EOF
2262
-
2272
test_expect_success 'R: multiple --import-marks= should be honoured' '
2273
+ cat >input <<-EOF &&
2274
+ feature import-marks=nonexistent.marks
2275
+ feature export-marks=combined.marks
2276
+ EOF
2277
+
2278
head -n2 marks.out > one.marks &&
2279
tail -n +3 marks.out > two.marks &&
2280
git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
2281
test_cmp marks.out combined.marks
2282
'
2283
2270
-cat >input <<-EOF &&
2271
-feature relative-marks
2272
-feature import-marks=relative.in
2273
-feature export-marks=relative.out
2274
-EOF
2275
-
2284
test_expect_success 'R: feature relative-marks should be honoured' '
2285
+ cat >input <<-EOF &&
2286
+ feature relative-marks
2287
+ feature import-marks=relative.in
2288
+ feature export-marks=relative.out
2289
+ EOF
2290
+
2291
mkdir -p .git/info/fast-import/ &&
2292
cp marks.new .git/info/fast-import/relative.in &&
2293
git fast-import <input &&
2294
test_cmp marks.new .git/info/fast-import/relative.out
2295
'
2296
2283
-cat >input <<-EOF &&
2284
-feature relative-marks
2285
-feature import-marks=relative.in
2286
-feature no-relative-marks
2287
-feature export-marks=non-relative.out
2288
-EOF
2289
-
2297
test_expect_success 'R: feature no-relative-marks should be honoured' '
2298
+ cat >input <<-EOF &&
2299
+ feature relative-marks
2300
+ feature import-marks=relative.in
2301
+ feature no-relative-marks
2302
+ feature export-marks=non-relative.out
2303
+ EOF
2304
+
2305
git fast-import <input &&
2306
test_cmp marks.new non-relative.out
2307
'
@@ -2549,15 +2563,15 @@ test_expect_success PIPE 'R: print staged blob within commit' '
2563
test_cmp expect actual
2564
'
2565
2552
-cat >input <<-EOF &&
2553
-option git quiet
2554
-blob
2555
-data 3
2556
-hi
2566
+test_expect_success 'R: quiet option results in no stats being output' '
2567
+ cat >input <<-EOF &&
2568
+ option git quiet
2569
+ blob
2570
+ data 3
2571
+ hi
2572
2558
-EOF
2573
+ EOF
2574
2560
-test_expect_success 'R: quiet option results in no stats being output' '
2575
cat input | git fast-import 2> output &&
2576
test_must_be_empty output
2577
'
@@ -2604,11 +2618,11 @@ test_expect_success 'R: terminating "done" within commit' '
2618
test_cmp expect actual
2619
'
2620
2607
-cat >input <<-EOF &&
2608
-option git non-existing-option
2609
-EOF
2610
-
2621
test_expect_success 'R: die on unknown option' '
2622
+ cat >input <<-EOF &&
2623
+ option git non-existing-option
2624
+ EOF
2625
+
2626
test_must_fail git fast-import <input
2627
'
2628
@@ -2624,38 +2638,38 @@ test_expect_success 'R: die on invalid option argument' '
2638
test_must_fail git fast-import --depth="5 elephants" </dev/null
2639
'
2640
2627
-cat >input <<-EOF &&
2628
-option non-existing-vcs non-existing-option
2629
-EOF
2630
-
2641
test_expect_success 'R: ignore non-git options' '
2642
+ cat >input <<-EOF &&
2643
+ option non-existing-vcs non-existing-option
2644
+ EOF
2645
+
2646
git fast-import <input
2647
'
2648
2649
##
2650
## R: very large blobs
2651
##
2638
-blobsize=$((2*1024*1024 + 53))
2639
-test-genrandom bar $blobsize >expect
2640
-cat >input <<-INPUT_END &&
2641
-commit refs/heads/big-file
2642
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2643
-data <<COMMIT
2644
-R - big file
2645
-COMMIT
2646
-
2647
-M 644 inline big1
2648
-data $blobsize
2649
-INPUT_END
2650
-cat expect >>input
2651
-cat >>input <<-INPUT_END &&
2652
-M 644 inline big2
2653
-data $blobsize
2654
-INPUT_END
2655
-cat expect >>input
2656
-echo >>input
2657
-
2652
test_expect_success 'R: blob bigger than threshold' '
2653
+ blobsize=$((2*1024*1024 + 53)) &&
2654
+ test-genrandom bar $blobsize >expect &&
2655
+ cat >input <<-INPUT_END &&
2656
+ commit refs/heads/big-file
2657
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2658
+ data <<COMMIT
2659
+ R - big file
2660
+ COMMIT
2661
+
2662
+ M 644 inline big1
2663
+ data $blobsize
2664
+ INPUT_END
2665
+ cat expect >>input &&
2666
+ cat >>input <<-INPUT_END &&
2667
+ M 644 inline big2
2668
+ data $blobsize
2669
+ INPUT_END
2670
+ cat expect >>input &&
2671
+ echo >>input &&
2672
+
2673
test_create_repo R &&
2674
git --git-dir=R/.git fast-import --big-file-threshold=1 <input
2675
'
@@ -2711,46 +2725,46 @@ test_expect_success 'R: blob appears only once' '
2725
#
2726
# Invalid dataref ..
2727
#
2714
-test_tick
2715
-
2716
-cat >input <<-INPUT_END &&
2717
-commit refs/heads/S
2718
-mark :301
2719
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2720
-data <<COMMIT
2721
-commit 1
2722
-COMMIT
2723
-M 100644 inline hello.c
2724
-data <<BLOB
2725
-blob 1
2726
-BLOB
2727
-
2728
-commit refs/heads/S
2729
-mark :302
2730
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2731
-data <<COMMIT
2732
-commit 2
2733
-COMMIT
2734
-from :301
2735
-M 100644 inline hello.c
2736
-data <<BLOB
2737
-blob 2
2738
-BLOB
2739
-
2740
-blob
2741
-mark :403
2742
-data <<BLOB
2743
-blob 3
2744
-BLOB
2745
-
2746
-blob
2747
-mark :202
2748
-data <<BLOB
2749
-note 2
2750
-BLOB
2751
-INPUT_END
2752
-
2728
test_expect_success 'S: initialize for S tests' '
2729
+ test_tick &&
2730
+
2731
+ cat >input <<-INPUT_END &&
2732
+ commit refs/heads/S
2733
+ mark :301
2734
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2735
+ data <<COMMIT
2736
+ commit 1
2737
+ COMMIT
2738
+ M 100644 inline hello.c
2739
+ data <<BLOB
2740
+ blob 1
2741
+ BLOB
2742
+
2743
+ commit refs/heads/S
2744
+ mark :302
2745
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
2746
+ data <<COMMIT
2747
+ commit 2
2748
+ COMMIT
2749
+ from :301
2750
+ M 100644 inline hello.c
2751
+ data <<BLOB
2752
+ blob 2
2753
+ BLOB
2754
+
2755
+ blob
2756
+ mark :403
2757
+ data <<BLOB
2758
+ blob 3
2759
+ BLOB
2760
+
2761
+ blob
2762
+ mark :202
2763
+ data <<BLOB
2764
+ note 2
2765
+ BLOB
2766
+ INPUT_END
2767
+
2768
git fast-import --export-marks=marks <input
2769
'
2770
@@ -3002,103 +3016,103 @@ test_expect_success 'T: empty reset doesnt delete branch' '
3016
### series U (filedelete)
3017
###
3018
3005
-cat >input <<-INPUT_END &&
3006
-commit refs/heads/U
3007
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3008
-data <<COMMIT
3009
-test setup
3010
-COMMIT
3011
-M 100644 inline hello.c
3012
-data <<BLOB
3013
-blob 1
3014
-BLOB
3015
-M 100644 inline good/night.txt
3016
-data <<BLOB
3017
-sleep well
3018
-BLOB
3019
-M 100644 inline good/bye.txt
3020
-data <<BLOB
3021
-au revoir
3022
-BLOB
3023
-
3024
-INPUT_END
3025
-
3019
test_expect_success 'U: initialize for U tests' '
3020
+ cat >input <<-INPUT_END &&
3021
+ commit refs/heads/U
3022
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3023
+ data <<COMMIT
3024
+ test setup
3025
+ COMMIT
3026
+ M 100644 inline hello.c
3027
+ data <<BLOB
3028
+ blob 1
3029
+ BLOB
3030
+ M 100644 inline good/night.txt
3031
+ data <<BLOB
3032
+ sleep well
3033
+ BLOB
3034
+ M 100644 inline good/bye.txt
3035
+ data <<BLOB
3036
+ au revoir
3037
+ BLOB
3038
+
3039
+ INPUT_END
3040
+
3041
git fast-import <input
3042
'
3043
3030
-cat >input <<-INPUT_END &&
3031
-commit refs/heads/U
3032
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3033
-data <<COMMIT
3034
-delete good/night.txt
3035
-COMMIT
3036
-from refs/heads/U^0
3037
-D good/night.txt
3044
+test_expect_success 'U: filedelete file succeeds' '
3045
+ cat >input <<-INPUT_END &&
3046
+ commit refs/heads/U
3047
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3048
+ data <<COMMIT
3049
+ delete good/night.txt
3050
+ COMMIT
3051
+ from refs/heads/U^0
3052
+ D good/night.txt
3053
3039
-INPUT_END
3054
+ INPUT_END
3055
3041
-test_expect_success 'U: filedelete file succeeds' '
3056
git fast-import <input
3057
'
3058
3045
-cat >expect <<-EOF &&
3046
-:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3047
-EOF
3059
+test_expect_success 'U: validate file delete result' '
3060
+ cat >expect <<-EOF &&
3061
+ :100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D good/night.txt
3062
+ EOF
3063
3049
-git diff-tree -M -r U^1 U >actual
3064
+ git diff-tree -M -r U^1 U >actual &&
3065
3051
-test_expect_success 'U: validate file delete result' '
3066
compare_diff_raw expect actual
3067
'
3068
3055
-cat >input <<-INPUT_END &&
3056
-commit refs/heads/U
3057
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3058
-data <<COMMIT
3059
-delete good dir
3060
-COMMIT
3061
-from refs/heads/U^0
3062
-D good
3069
+test_expect_success 'U: filedelete directory succeeds' '
3070
+ cat >input <<-INPUT_END &&
3071
+ commit refs/heads/U
3072
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3073
+ data <<COMMIT
3074
+ delete good dir
3075
+ COMMIT
3076
+ from refs/heads/U^0
3077
+ D good
3078
3064
-INPUT_END
3079
+ INPUT_END
3080
3066
-test_expect_success 'U: filedelete directory succeeds' '
3081
git fast-import <input
3082
'
3083
3070
-cat >expect <<-EOF &&
3071
-:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3072
-EOF
3084
+test_expect_success 'U: validate directory delete result' '
3085
+ cat >expect <<-EOF &&
3086
+ :100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D good/bye.txt
3087
+ EOF
3088
3074
-git diff-tree -M -r U^1 U >actual
3089
+ git diff-tree -M -r U^1 U >actual &&
3090
3076
-test_expect_success 'U: validate directory delete result' '
3091
compare_diff_raw expect actual
3092
'
3093
3080
-cat >input <<-INPUT_END &&
3081
-commit refs/heads/U
3082
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3083
-data <<COMMIT
3084
-must succeed
3085
-COMMIT
3086
-from refs/heads/U^0
3087
-D ""
3094
+test_expect_success 'U: filedelete root succeeds' '
3095
+ cat >input <<-INPUT_END &&
3096
+ commit refs/heads/U
3097
+ committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
3098
+ data <<COMMIT
3099
+ must succeed
3100
+ COMMIT
3101
+ from refs/heads/U^0
3102
+ D ""
3103
3089
-INPUT_END
3104
+ INPUT_END
3105
3091
-test_expect_success 'U: filedelete root succeeds' '
3106
git fast-import <input
3107
'
3108
3095
-cat >expect <<-EOF &&
3096
-:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3097
-EOF
3109
+test_expect_success 'U: validate root delete result' '
3110
+ cat >expect <<-EOF &&
3111
+ :100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D hello.c
3112
+ EOF
3113
3099
-git diff-tree -M -r U^1 U >actual
3114
+ git diff-tree -M -r U^1 U >actual &&
3115
3101
-test_expect_success 'U: validate root delete result' '
3116
compare_diff_raw expect actual
3117
'
3118