From d9b936db5226ed4b87d42a2c91324adc50c768b6 Mon Sep 17 00:00:00 2001 From: Anders Waldenborg Date: Mon, 28 Jan 2019 22:33:35 +0100 Subject: pretty: add support for "valueonly" option in %(trailers) With the new "key=" option to %(trailers) it often makes little sense to show the key, as it by definition already is knows which trailer is printed there. This new "valueonly" option makes it omit the key when printing trailers. E.g.: $ git show -s --pretty='%s%n%(trailers:key=Signed-off-by,valueonly)' aaaa88182 will show: > upload-pack: fix broken if/else chain in config callback > Jeff King > Junio C Hamano Signed-off-by: Anders Waldenborg Signed-off-by: Junio C Hamano --- t/t4205-log-pretty-formats.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't/t4205-log-pretty-formats.sh') diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index d87201afbe..1ad6834781 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -673,6 +673,12 @@ test_expect_success '%(trailers:key) without value is error' ' test_cmp expect actual ' +test_expect_success '%(trailers:key=foo,valueonly) shows only value' ' + git log --no-walk --pretty="format:%(trailers:key=Acked-by,valueonly)" >actual && + echo "A U Thor " >expect && + test_cmp expect actual +' + test_expect_success 'trailer parsing not fooled by --- line' ' git commit --allow-empty -F - <<-\EOF && this is the subject -- cgit v1.2.3