Skip to content

Commit 624b44d

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ced1f08 commit 624b44d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

t/t6300-for-each-ref.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,18 +605,25 @@ test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
605605
cat >trailers <<EOF
606606
Reviewed-by: A U Thor <[email protected]>
607607
Signed-off-by: A U Thor <[email protected]>
608+
[ v2 updated patch description ]
609+
Acked-by: A U Thor
610+
608611
EOF
609612

610-
test_expect_success 'basic atom: head contents:trailers' '
613+
614+
test_expect_success 'set up trailers for next test' '
611615
echo "Some contents" > two &&
612616
git add two &&
613-
git commit -F - <<-EOF &&
617+
git commit -F - <<-EOF
614618
trailers: this commit message has trailers
615619
616620
Some message contents
617621
618622
$(cat trailers)
619623
EOF
624+
'
625+
626+
test_expect_success 'basic atom: head contents:trailers' '
620627
git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
621628
sanitize_pgp <actual >actual.clean &&
622629
# git for-each-ref ends with a blank line

0 commit comments

Comments
 (0)