t6300: refactor %(trailers) tests
We currently have one test for %(trailers) in `git-for-each-ref(1)`, through "%(contents:trailers)". In preparation for more, let's add a few things: - Move the commit creation step to its own test so that it can be re-used. - Add a non-trailer to the commit's trailers to test that non-trailers aren't shown using "%(trailers:only)". - Add a multi-line trailer to ensure that trailers are unfolded correctly using "%(trailers:unfold)". Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Oct 1, 2017 at 22:25 UTC
624b44d3763bd10e51fdcf66a205535140ca8539
1 file changed
+9
-2
t/t6300-for-each-ref.sh
+9
-2
@@ -605,18 +605,25 @@ test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
605
cat >trailers <<EOF
606
Reviewed-by: A U Thor <author@example.com>
607
Signed-off-by: A U Thor <author@example.com>
608
+[ v2 updated patch description ]
609
+Acked-by: A U Thor
610
+ <author@example.com>
611
EOF
612
610
-test_expect_success 'basic atom: head contents:trailers' '
613
+
614
+test_expect_success 'set up trailers for next test' '
615
echo "Some contents" > two &&
616
git add two &&
613
- git commit -F - <<-EOF &&
617
+ git commit -F - <<-EOF
618
trailers: this commit message has trailers
619
620
Some message contents
621
622
$(cat trailers)
623
EOF
624
+'
625
+
626
+test_expect_success 'basic atom: head contents:trailers' '
627
git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
628
sanitize_pgp <actual >actual.clean &&
629
# git for-each-ref ends with a blank line