On Sun, Nov 18, 2018 at 6:45 AM Anders Waldenborg <and...@0x63.nu> wrote:
> By default trailer lines are terminated by linebreaks ('\n'). By
> specifying the new 'separator' option they will instead be separated by
> user provided string and have separator semantics rather than terminator
> semantics. The separator string can contain the literal formatting codes
> %n and %xNN allowing it to be things that are otherwise hard to type as
> %x00, or comma and end-parenthesis which would break parsing.
>
> Signed-off-by: Anders Waldenborg <and...@0x63.nu>
> ---
> diff --git a/Documentation/pretty-formats.txt 
> b/Documentation/pretty-formats.txt
> @@ -218,9 +218,16 @@ endif::git-rev-list[]
> +  ** 'separator=<SEP>': specifying an alternative separator than the
> +     default line feed character. SEP may can contain the literal
> +     formatting codes %n and %xNN allowing it to contain characters
> +     that are hard to type such as %x00, or comma and end-parenthesis
> +     which would break parsing. If option is given multiple times only
> +     the last one is used.

It's not clear from this documentation what constitutes a valid <SEP>.
Is it restricted to a single character? Can it be an arbitrary string?
If a string, does it need to be quoted? Does it support backslash
escaping?

Although I was able to guess that %xNN allowed hex input of a 7- or
8-bit value, I found myself wondering what I was supposed to replace
'n' with in "%n". I didn't fathom that "%n" was meant to be typed
literally to specify a newline character.

> +  ** Examples: `%(trailers:only,unfold,separator=%x00)` unfolds and
> +     shows all trailer lines separated by NUL character,
> +     `%(trailers:key=Reviewed-by,unfold)` unfolds and shows trailer
> +     lines with key `Reviewed-by`.

Reply via email to