Add %(decorate[:<options>]) format that lists ref names similarly to the
%d format, but which allows the otherwise fixed prefix, suffix and
separator strings to be customized. Omitted options default to the
strings used in %d.
Rename expand_separator() function used to expand %x literal formatting
codes to expand_string_arg(), as it is now used on strings other than
separators.
Examples:
- %(decorate) is equivalent to %d.
- %(decorate:prefix=,suffix=) is equivalent to %D.
- %(decorate:prefix=[,suffix=],separator=%x3B) produces a list enclosed
in square brackets and separated by semicolons.
Test the format in t4205-log-pretty-formats.sh and document it in
pretty-formats.txt.
Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Andy Koppe committedAug 20, 2023 at 19:50 UTCa58dd835e9536cf9e7adcd404d008a44d29af804
3 files changed+92-4
Documentation/pretty-formats.txt
+10
index 851a9878e6..709d85af21 100644--- a/Documentation/pretty-formats.txt+++ b/Documentation/pretty-formats.txt@@ -224,6 +224,16 @@ The placeholders are: linkgit:git-rev-list[1]) '%d':: ref names, like the --decorate option of linkgit:git-log[1] '%D':: ref names without the " (", ")" wrapping.+'%(decorate[:<options>])'::+ref names with custom decorations. The `decorate` string may be followed by a+colon and zero or more comma-separated options. Option values may contain+literal formatting codes. These must be used for commas (`%x2C`) and closing+parentheses (`%x29`), due to their role in the option syntax.+++** 'prefix=<value>': Shown before the list of ref names. Defaults to "{nbsp}`(`".+** 'suffix=<value>': Shown after the list of ref names. Defaults to "`)`".+** 'separator=<value>': Shown between ref names. Defaults to "`,`{nbsp}".+ '%(describe[:<options>])':: human-readable name, like linkgit:git-describe[1]; empty string for undescribable commits. The `describe` string may be followed by a colon and