mirror of
https://github.com/git/git.git
synced 2026-03-20 13:40:08 +01:00
Pretty-format: %[+-]x to tweak inter-item newlines
This teaches the "pretty" machinery to expand '%+x' to a LF followed by the expansion of '%x' if and only if '%x' expands to a non-empty string, and to remove LFs before '%-x' if '%x' expands to an empty string. This works for any supported expansion placeholder 'x'. This is expected to be immediately useful to reproduce the commit log message with "%s%+b%n"; "%s%n%b%n" adds one extra LF if the log message is a one-liner. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -132,6 +132,14 @@ The placeholders are:
|
||||
- '%n': newline
|
||||
- '%x00': print a byte from a hex code
|
||||
|
||||
If you add a `{plus}` (plus sign) after '%' of a placeholder, a line-feed
|
||||
is inserted immediately before the expansion if and only if the
|
||||
placeholder expands to a non-empty string.
|
||||
|
||||
If you add a `-` (minus sign) after '%' of a placeholder, line-feeds that
|
||||
immediately precede the expansion are deleted if and only if the
|
||||
placeholder expands to an empty string.
|
||||
|
||||
* 'tformat:'
|
||||
+
|
||||
The 'tformat:' format works exactly like 'format:', except that it
|
||||
|
||||
Reference in New Issue
Block a user