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>
This commit is contained in:
Jacob Keller
2016-11-18 16:58:14 -08:00
committed by Junio C Hamano
parent 967dfd4d56
commit d9f31fbfe9
3 changed files with 45 additions and 0 deletions

View File

@ -199,6 +199,8 @@ endif::git-rev-list[]
than given and there are spaces on its left, use those spaces
- '%><(<N>)', '%><|(<N>)': similar to '% <(<N>)', '%<|(<N>)'
respectively, but padding both sides (i.e. the text is centered)
-%(trailers): display the trailers of the body as interpreted by
linkgit:git-interpret-trailers[1]
NOTE: Some placeholders may depend on other options given to the
revision traversal engine. For example, the `%g*` reflog options will