@@ -296,9 +296,11 @@ tag_size=$(strlen "$tag_content")
296
296
297
297
run_tests ' tag' $tag_sha1 $tag_size " $tag_content " " $tag_content "
298
298
299
- test_expect_success \
300
- " Reach a blob from a tag pointing to it" \
301
- " test '$hello_content ' = \"\$ (git cat-file blob $tag_sha1 )\" "
299
+ test_expect_success " Reach a blob from a tag pointing to it" '
300
+ echo_without_newline "$hello_content" >expect &&
301
+ git cat-file blob $tag_sha1 >actual &&
302
+ test_cmp expect actual
303
+ '
302
304
303
305
for batch in batch batch-check batch-command
304
306
do
334
336
done
335
337
336
338
test_expect_success " --batch-check for a non-existent named object" '
337
- test "foobar42 missing
338
- foobar84 missing" = \
339
- "$( ( echo foobar42 && echo_without_newline foobar84 ) | git cat-file --batch-check)"
339
+ cat >expect <<-EOF &&
340
+ foobar42 missing
341
+ foobar84 missing
342
+ EOF
343
+
344
+ printf "foobar42\nfoobar84" >in &&
345
+ git cat-file --batch-check <in >actual &&
346
+ test_cmp expect actual
340
347
'
341
348
342
349
test_expect_success " --batch-check for a non-existent hash" '
343
- test "0000000000000000000000000000000000000042 missing
344
- 0000000000000000000000000000000000000084 missing" = \
345
- "$( ( echo 0000000000000000000000000000000000000042 &&
346
- echo_without_newline 0000000000000000000000000000000000000084 ) |
347
- git cat-file --batch-check)"
350
+ cat >expect <<-EOF &&
351
+ 0000000000000000000000000000000000000042 missing
352
+ 0000000000000000000000000000000000000084 missing
353
+ EOF
354
+
355
+ printf "0000000000000000000000000000000000000042\n0000000000000000000000000000000000000084" >in &&
356
+ git cat-file --batch-check <in >actual &&
357
+ test_cmp expect actual
348
358
'
349
359
350
360
test_expect_success " --batch for an existent and a non-existent hash" '
351
- test "$tag_sha1 tag $tag_size
352
- $tag_content
353
- 0000000000000000000000000000000000000000 missing" = \
354
- "$( ( echo $tag_sha1 &&
355
- echo_without_newline 0000000000000000000000000000000000000000 ) |
356
- git cat-file --batch)"
361
+ cat >expect <<-EOF &&
362
+ $tag_sha1 tag $tag_size
363
+ $tag_content
364
+ 0000000000000000000000000000000000000000 missing
365
+ EOF
366
+
367
+ printf "$tag_sha1\n0000000000000000000000000000000000000000" >in &&
368
+ git cat-file --batch <in >actual &&
369
+ test_cmp expect actual
357
370
'
358
371
359
372
test_expect_success " --batch-check for an empty line" '
360
- test " missing" = "$(echo | git cat-file --batch-check)"
373
+ cat >expect <<-EOF &&
374
+ missing
375
+ EOF
376
+
377
+ echo >in &&
378
+ git cat-file --batch-check <in >actual &&
379
+ test_cmp expect actual
361
380
'
362
381
363
382
test_expect_success ' empty --batch-check notices missing object' '
@@ -384,7 +403,8 @@ deadbeef missing
384
403
385
404
test_expect_success ' --batch with multiple sha1s gives correct format' '
386
405
echo "$batch_output" >expect &&
387
- echo_without_newline "$batch_input" | git cat-file --batch >actual &&
406
+ echo_without_newline "$batch_input" >in &&
407
+ git cat-file --batch <in >actual &&
388
408
test_cmp expect actual
389
409
'
390
410
@@ -411,13 +431,17 @@ deadbeef missing
411
431
missing"
412
432
413
433
test_expect_success " --batch-check with multiple sha1s gives correct format" '
414
- test "$batch_check_output" = \
415
- "$(echo_without_newline "$batch_check_input" | git cat-file --batch-check)"
434
+ echo "$batch_check_output" >expect &&
435
+ echo_without_newline "$batch_check_input" >in &&
436
+ git cat-file --batch-check <in >actual &&
437
+ test_cmp expect actual
416
438
'
417
439
418
440
test_expect_success " --batch-check, -z with multiple sha1s gives correct format" '
419
- echo_without_newline_nul "$batch_check_input" >in &&
420
- test "$batch_check_output" = "$(git cat-file --batch-check -z <in)"
441
+ echo "$batch_check_output" >expect &&
442
+ echo_without_newline_nul "$batch_check_input" >in &&
443
+ git cat-file --batch-check -z <in >actual &&
444
+ test_cmp expect actual
421
445
'
422
446
423
447
test_expect_success FUNNYNAMES ' --batch-check, -z with newline in input' '
0 commit comments