aboutsummaryrefslogtreecommitdiff
path: root/t/t4205-log-pretty-formats.sh
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2016-11-18 16:58:14 -0800
committerJunio C Hamano <gitster@pobox.com>2016-12-11 13:58:41 -0800
commitd9f31fbfe98e0e363a3c69aaf6badecc746afe6b (patch)
treee8aeacdbd2aae73e2ffc4f9497c19e321e1548e3 /t/t4205-log-pretty-formats.sh
parent967dfd4d568c2b102281de8cc22ee35f7558358b (diff)
downloadgit-d9f31fbfe98e0e363a3c69aaf6badecc746afe6b.tar.gz
git-d9f31fbfe98e0e363a3c69aaf6badecc746afe6b.tar.xz
pretty: add %(trailers) format for displaying trailers of a commit message
Recent patches have expanded on the trailers.c code and we have the builtin commant git-interpret-trailers which can be used to add or modify trailer lines. However, there is no easy way to simply display the trailers of a commit message. Add support for %(trailers) format modifier which will use the trailer_info_get() calls to read trailers in an identical way as git interpret-trailers does. Use a long format option instead of a short name so that future work can more easily unify ref-filter and pretty formats. Add documentation and tests for the same. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4205-log-pretty-formats.sh')
-rwxr-xr-xt/t4205-log-pretty-formats.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index f5435fd25..21eb8c858 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -535,4 +535,30 @@ test_expect_success 'clean log decoration' '
test_cmp expected actual1
'
+cat >trailers <<EOF
+Signed-off-by: A U Thor <author@example.com>
+Acked-by: A U Thor <author@example.com>
+[ v2 updated patch description ]
+Signed-off-by: A U Thor <author@example.com>
+EOF
+
+test_expect_success 'pretty format %(trailers) shows trailers' '
+ echo "Some contents" >trailerfile &&
+ git add trailerfile &&
+ git commit -F - <<-EOF &&
+ trailers: this commit message has trailers
+
+ This commit is a test commit with trailers at the end. We parse this
+ message and display the trailers using %bT
+
+ $(cat trailers)
+ EOF
+ git log --no-walk --pretty="%(trailers)" >actual &&
+ cat >expect <<-EOF &&
+ $(cat trailers)
+
+ EOF
+ test_cmp expect actual
+'
+
test_done