From e5fba5d55886eaf48aeeb158dd4d30c2fc0294c9 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 22 Aug 2018 20:50:17 -0400 Subject: pretty, ref-filter: format %(trailers) with no_divider option In both of these cases we know that we are feeding the trailer-parsing code a pure commit message. We should tell it so, which avoids false positives for a commit message that contains a "---" line. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t6300-for-each-ref.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 't/t6300-for-each-ref.sh') diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 48379aa0ee..3d26ba0c2a 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -715,6 +715,29 @@ test_expect_success 'basic atom: head contents:trailers' ' test_cmp expect actual.clean ' +test_expect_success 'trailer parsing not fooled by --- line' ' + git commit --allow-empty -F - <<-\EOF && + this is the subject + + This is the body. The message has a "---" line which would confuse a + message+patch parser. But here we know we have only a commit message, + so we get it right. + + trailer: wrong + --- + This is more body. + + trailer: right + EOF + + { + echo "trailer: right" && + echo + } >expect && + git for-each-ref --format="%(trailers)" refs/heads/master >actual && + test_cmp expect actual +' + test_expect_success 'Add symbolic ref for the following tests' ' git symbolic-ref refs/heads/sym refs/heads/master ' -- cgit v1.2.3