@@ -776,61 +776,40 @@ test_expect_success 'set up trailers for next test' '
776
776
'
777
777
778
778
test_expect_success ' %(trailers:unfold) unfolds trailers' '
779
- git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual &&
780
779
{
781
780
unfold <trailers
782
781
echo
783
782
} >expect &&
783
+ git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual &&
784
+ test_cmp expect actual &&
785
+ git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
784
786
test_cmp expect actual
785
787
'
786
788
787
789
test_expect_success ' %(trailers:only) shows only "key: value" trailers' '
788
- git for-each-ref --format="%(trailers:only)" refs/heads/master >actual &&
789
790
{
790
791
grep -v patch.description <trailers &&
791
792
echo
792
793
} >expect &&
794
+ git for-each-ref --format="%(trailers:only)" refs/heads/master >actual &&
795
+ test_cmp expect actual &&
796
+ git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
793
797
test_cmp expect actual
794
798
'
795
799
796
800
test_expect_success ' %(trailers:only) and %(trailers:unfold) work together' '
797
- git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual &&
798
- git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >reverse &&
799
- test_cmp actual reverse &&
800
801
{
801
802
grep -v patch.description <trailers | unfold &&
802
803
echo
803
804
} >expect &&
804
- test_cmp expect actual
805
- '
806
-
807
- test_expect_success ' %(contents:trailers:unfold) unfolds trailers' '
808
- git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
809
- {
810
- unfold <trailers
811
- echo
812
- } >expect &&
813
- test_cmp expect actual
814
- '
815
-
816
- test_expect_success ' %(contents:trailers:only) shows only "key: value" trailers' '
817
- git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
818
- {
819
- grep -v patch.description <trailers &&
820
- echo
821
- } >expect &&
822
- test_cmp expect actual
823
- '
824
-
825
- test_expect_success ' %(contents:trailers:only) and %(contents:trailers:unfold) work together' '
805
+ git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual &&
806
+ test_cmp expect actual &&
807
+ git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >actual &&
808
+ test_cmp actual actual &&
826
809
git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual &&
827
- git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >reverse &&
828
- test_cmp actual reverse &&
829
- {
830
- grep -v patch.description <trailers | unfold &&
831
- echo
832
- } >expect &&
833
- test_cmp expect actual
810
+ test_cmp expect actual &&
811
+ git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >actual &&
812
+ test_cmp actual actual
834
813
'
835
814
836
815
test_expect_success ' %(trailers) rejects unknown trailers arguments' '
@@ -839,15 +818,16 @@ test_expect_success '%(trailers) rejects unknown trailers arguments' '
839
818
fatal: unknown %(trailers) argument: unsupported
840
819
EOF
841
820
test_must_fail git for-each-ref --format="%(trailers:unsupported)" 2>actual &&
821
+ test_i18ncmp expect actual &&
822
+ test_must_fail git for-each-ref --format="%(contents:trailers:unsupported)" 2>actual &&
842
823
test_i18ncmp expect actual
843
824
'
844
825
845
- test_expect_success ' %(contents:trailers) rejects unknown trailers arguments' '
846
- # error message cannot be checked under i18n
826
+ test_expect_success ' if arguments, %(contents:trailers) shows error if colon is missing' '
847
827
cat >expect <<-EOF &&
848
- fatal: unknown %(trailers ) argument: unsupported
828
+ fatal: unrecognized %(contents ) argument: trailersonly
849
829
EOF
850
- test_must_fail git for-each-ref --format="%(contents:trailers:unsupported )" 2>actual &&
830
+ test_must_fail git for-each-ref --format="%(contents:trailersonly )" 2>actual &&
851
831
test_i18ncmp expect actual
852
832
'
853
833
0 commit comments