@@ -281,8 +281,9 @@ test_expect_success 'stop on conflicting pick' '
281
281
test_cmp expect2 file1 &&
282
282
test "$(git diff --name-status |
283
283
sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
284
- test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) &&
285
- test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo)
284
+ grep -v "^#" <.git/rebase-merge/done >actual &&
285
+ test_line_count = 4 actual &&
286
+ test 0 = $(grep -c "^[^#]" <.git/rebase-merge/git-rebase-todo)
286
287
'
287
288
288
289
test_expect_success ' show conflicted patch' '
@@ -319,7 +320,8 @@ test_expect_success 'retain authorship' '
319
320
GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" &&
320
321
git tag twerp &&
321
322
git rebase -i --onto primary HEAD^ &&
322
- git show HEAD | grep "^Author: Twerp Snog"
323
+ git show HEAD >actual &&
324
+ grep "^Author: Twerp Snog" actual
323
325
'
324
326
325
327
test_expect_success ' retain authorship w/ conflicts' '
@@ -360,7 +362,8 @@ test_expect_success 'squash' '
360
362
'
361
363
362
364
test_expect_success ' retain authorship when squashing' '
363
- git show HEAD | grep "^Author: Twerp Snog"
365
+ git show HEAD >actual &&
366
+ grep "^Author: Twerp Snog" actual
364
367
'
365
368
366
369
test_expect_success ' --continue tries to commit' '
@@ -374,7 +377,8 @@ test_expect_success '--continue tries to commit' '
374
377
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue
375
378
) &&
376
379
test_cmp_rev HEAD^ new-branch1 &&
377
- git show HEAD | grep chouette
380
+ git show HEAD >actual &&
381
+ grep chouette actual
378
382
'
379
383
380
384
test_expect_success ' verbose flag is heeded, even after --continue' '
@@ -397,7 +401,9 @@ test_expect_success 'multi-squash only fires up editor once' '
397
401
git rebase -i $base
398
402
) &&
399
403
test $base = $(git rev-parse HEAD^) &&
400
- test 1 = $(git show | grep ONCE | wc -l)
404
+ git show >output &&
405
+ grep ONCE output >actual &&
406
+ test_line_count = 1 actual
401
407
'
402
408
403
409
test_expect_success ' multi-fixup does not fire up editor' '
@@ -410,7 +416,8 @@ test_expect_success 'multi-fixup does not fire up editor' '
410
416
git rebase -i $base
411
417
) &&
412
418
test $base = $(git rev-parse HEAD^) &&
413
- test 0 = $(git show | grep NEVER | wc -l) &&
419
+ git show >output &&
420
+ ! grep NEVER output &&
414
421
git checkout @{-1} &&
415
422
git branch -D multi-fixup
416
423
'
@@ -428,7 +435,9 @@ test_expect_success 'commit message used after conflict' '
428
435
git rebase --continue
429
436
) &&
430
437
test $base = $(git rev-parse HEAD^) &&
431
- test 1 = $(git show | grep ONCE | wc -l) &&
438
+ git show >output &&
439
+ grep ONCE output >actual &&
440
+ test_line_count = 1 actual &&
432
441
git checkout @{-1} &&
433
442
git branch -D conflict-fixup
434
443
'
@@ -446,7 +455,9 @@ test_expect_success 'commit message retained after conflict' '
446
455
git rebase --continue
447
456
) &&
448
457
test $base = $(git rev-parse HEAD^) &&
449
- test 2 = $(git show | grep TWICE | wc -l) &&
458
+ git show >output &&
459
+ grep TWICE output >actual &&
460
+ test_line_count = 2 actual &&
450
461
git checkout @{-1} &&
451
462
git branch -D conflict-squash
452
463
'
@@ -470,10 +481,10 @@ test_expect_success 'squash and fixup generate correct log messages' '
470
481
) &&
471
482
git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup &&
472
483
test_cmp expect-squash-fixup actual-squash-fixup &&
473
- git cat-file commit HEAD@{2} |
474
- grep "^# This is a combination of 3 commits\." &&
475
- git cat-file commit HEAD@{3} |
476
- grep "^# This is a combination of 2 commits\." &&
484
+ git cat-file commit HEAD@{2} >actual &&
485
+ grep "^# This is a combination of 3 commits\." actual &&
486
+ git cat-file commit HEAD@{3} >actual &&
487
+ grep "^# This is a combination of 2 commits\." actual &&
477
488
git checkout @{-1} &&
478
489
git branch -D squash-fixup
479
490
'
@@ -489,7 +500,9 @@ test_expect_success 'squash ignores comments' '
489
500
git rebase -i $base
490
501
) &&
491
502
test $base = $(git rev-parse HEAD^) &&
492
- test 1 = $(git show | grep ONCE | wc -l) &&
503
+ git show >output &&
504
+ grep ONCE output >actual &&
505
+ test_line_count = 1 actual &&
493
506
git checkout @{-1} &&
494
507
git branch -D skip-comments
495
508
'
@@ -505,7 +518,9 @@ test_expect_success 'squash ignores blank lines' '
505
518
git rebase -i $base
506
519
) &&
507
520
test $base = $(git rev-parse HEAD^) &&
508
- test 1 = $(git show | grep ONCE | wc -l) &&
521
+ git show >output &&
522
+ grep ONCE output >actual &&
523
+ test_line_count = 1 actual &&
509
524
git checkout @{-1} &&
510
525
git branch -D skip-blank-lines
511
526
'
@@ -572,7 +587,8 @@ test_expect_success '--continue tries to commit, even for "edit"' '
572
587
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue
573
588
) &&
574
589
test edited = $(git show HEAD:file7) &&
575
- git show HEAD | grep chouette &&
590
+ git show HEAD >actual &&
591
+ grep chouette actual &&
576
592
test $parent = $(git rev-parse HEAD^)
577
593
'
578
594
@@ -757,19 +773,23 @@ test_expect_success 'reword' '
757
773
set_fake_editor &&
758
774
FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \
759
775
git rebase -i A &&
760
- git show HEAD | grep "E changed" &&
776
+ git show HEAD >actual &&
777
+ grep "E changed" actual &&
761
778
test $(git rev-parse primary) != $(git rev-parse HEAD) &&
762
779
test_cmp_rev primary^ HEAD^ &&
763
780
FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \
764
781
git rebase -i A &&
765
- git show HEAD^ | grep "D changed" &&
782
+ git show HEAD^ >actual &&
783
+ grep "D changed" actual &&
766
784
FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \
767
785
git rebase -i A &&
768
- git show HEAD~3 | grep "B changed" &&
786
+ git show HEAD~3 >actual &&
787
+ grep "B changed" actual &&
769
788
FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \
770
789
git rebase -i A
771
790
) &&
772
- git show HEAD~2 | grep "C changed"
791
+ git show HEAD~2 >actual &&
792
+ grep "C changed" actual
773
793
'
774
794
775
795
test_expect_success ' no uncommitted changes when rewording and the todo list is reloaded' '
@@ -1003,8 +1023,10 @@ test_expect_success 'rebase -i --root retain root commit author and message' '
1003
1023
set_fake_editor &&
1004
1024
FAKE_LINES="2" git rebase -i --root
1005
1025
) &&
1006
- git cat-file commit HEAD | grep -q "^author Twerp Snog" &&
1007
- git cat-file commit HEAD | grep -q "^different author$"
1026
+ git cat-file commit HEAD >output &&
1027
+ grep -q "^author Twerp Snog" output &&
1028
+ git cat-file commit HEAD >actual &&
1029
+ grep -q "^different author$" actual
1008
1030
'
1009
1031
1010
1032
test_expect_success ' rebase -i --root temporary sentinel commit' '
@@ -1013,7 +1035,8 @@ test_expect_success 'rebase -i --root temporary sentinel commit' '
1013
1035
set_fake_editor &&
1014
1036
test_must_fail env FAKE_LINES="2" git rebase -i --root
1015
1037
) &&
1016
- git cat-file commit HEAD | grep "^tree $EMPTY_TREE" &&
1038
+ git cat-file commit HEAD >actual &&
1039
+ grep "^tree $EMPTY_TREE" actual &&
1017
1040
git rebase --abort
1018
1041
'
1019
1042
@@ -1036,7 +1059,8 @@ test_expect_success 'rebase -i --root reword original root commit' '
1036
1059
FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \
1037
1060
git rebase -i --root
1038
1061
) &&
1039
- git show HEAD^ | grep "A changed" &&
1062
+ git show HEAD^ >actual &&
1063
+ grep "A changed" actual &&
1040
1064
test -z "$(git show -s --format=%p HEAD^)"
1041
1065
'
1042
1066
@@ -1048,7 +1072,8 @@ test_expect_success 'rebase -i --root reword new root commit' '
1048
1072
FAKE_LINES="reword 3 1" FAKE_COMMIT_MESSAGE="C changed" \
1049
1073
git rebase -i --root
1050
1074
) &&
1051
- git show HEAD^ | grep "C changed" &&
1075
+ git show HEAD^ >actual &&
1076
+ grep "C changed" actual &&
1052
1077
test -z "$(git show -s --format=%p HEAD^)"
1053
1078
'
1054
1079
0 commit comments