655
test_cmp expect actual
656
'
657
658
+test_expect_success '%(contents:trailers:unfold) unfolds trailers' '
659
+ git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
660
+ {
661
+ unfold <trailers
662
+ echo
663
+ } >expect &&
664
+ test_cmp expect actual
665
+'
666
+
667
+test_expect_success '%(contents:trailers:only) shows only "key: value" trailers' '
668
+ git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
669
+ {
670
+ grep -v patch.description <trailers &&
671
+ echo
672
+ } >expect &&
673
+ test_cmp expect actual
674
+'
675
+
676
+test_expect_success '%(contents:trailers:only) and %(contents:trailers:unfold) work together' '
677
+ git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual &&
678
+ git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >reverse &&
679
+ test_cmp actual reverse &&
680
+ {
681
+ grep -v patch.description <trailers | unfold &&
682
+ echo
683
+ } >expect &&
684
+ test_cmp expect actual
685
+'
686
+
687
test_expect_success '%(trailers) rejects unknown trailers arguments' '
688
# error message cannot be checked under i18n
689
cat >expect <<-EOF &&
693
test_i18ncmp expect actual
694
'
695
696
+test_expect_success '%(contents:trailers) rejects unknown trailers arguments' '
697
+ # error message cannot be checked under i18n
698
+ cat >expect <<-EOF &&
699
+ fatal: unknown %(trailers) argument: unsupported
700
+ EOF
701
+ test_must_fail git for-each-ref --format="%(contents:trailers:unsupported)" 2>actual &&
702
+ test_i18ncmp expect actual
703
+'
704
+
705
test_expect_success 'basic atom: head contents:trailers' '
706
git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
707
sanitize_pgp <actual >actual.clean &&