t4203: stop losing return codes of git commands
In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that their failure is reported. Signed-off-by: Denton Liu <liu.denton@gmail.com> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu committed
Jan 14, 2021 at 15:02 UTC
afa80f534b8f7d0422a6e8f208745f3cb94b5d1e
1 file changed
+14
-7
t/t4203-mailmap.sh
+14
-7
@@ -634,7 +634,8 @@ test_expect_success 'Log output with --use-mailmap' '
634
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
635
EOF
636
637
- git log --use-mailmap | grep Author >actual &&
637
+ git log --use-mailmap >log &&
638
+ grep Author log >actual &&
639
test_cmp expect actual
640
'
641
@@ -651,7 +652,8 @@ test_expect_success 'Log output with log.mailmap' '
652
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
653
EOF
654
654
- git -c log.mailmap=True log | grep Author >actual &&
655
+ git -c log.mailmap=True log >log &&
656
+ grep Author log >actual &&
657
test_cmp expect actual
658
'
659
@@ -665,7 +667,8 @@ test_expect_success 'log.mailmap=false disables mailmap' '
667
Author: nick1 <bugs@company.xx>
668
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
669
EOF
668
- git -c log.mailmap=false log | grep Author >actual &&
670
+ git -c log.mailmap=false log >log &&
671
+ grep Author log >actual &&
672
test_cmp expect actual
673
'
674
@@ -679,7 +682,8 @@ test_expect_success '--no-use-mailmap disables mailmap' '
682
Author: nick1 <bugs@company.xx>
683
Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
684
EOF
682
- git log --no-use-mailmap | grep Author > actual &&
685
+ git log --no-use-mailmap >log &&
686
+ grep Author log >actual &&
687
test_cmp expect actual
688
'
689
@@ -690,7 +694,8 @@ test_expect_success 'Grep author with --use-mailmap' '
694
Author: Santa Claus <santa.claus@northpole.xx>
695
Author: Santa Claus <santa.claus@northpole.xx>
696
EOF
693
- git log --use-mailmap --author Santa | grep Author >actual &&
697
+ git log --use-mailmap --author Santa >log &&
698
+ grep Author log >actual &&
699
test_cmp expect actual
700
'
701
@@ -702,13 +707,15 @@ test_expect_success 'Grep author with log.mailmap' '
707
Author: Santa Claus <santa.claus@northpole.xx>
708
EOF
709
705
- git -c log.mailmap=True log --author Santa | grep Author >actual &&
710
+ git -c log.mailmap=True log --author Santa >log &&
711
+ grep Author log >actual &&
712
test_cmp expect actual
713
'
714
715
test_expect_success 'log.mailmap is true by default these days' '
716
test_config mailmap.file complex.map &&
711
- git log --author Santa | grep Author >actual &&
717
+ git log --author Santa >log &&
718
+ grep Author log >actual &&
719
test_cmp expect actual
720
'
721