Web lists-archives.com

Re: [PATCH 2/5] interpret-trailers: add an option to show only the trailers

On Wed, Aug 9, 2017 at 5:24 AM, Jeff King <peff@xxxxxxxx> wrote:
> In theory it's easy for any reader who wants to parse
> trailers to do so. But there are a lot of subtle corner
> cases around what counts as a trailer, when the trailer
> block begins and ends, etc. Since interpret-trailers already
> has our parsing logic, let's let callers ask it to just
> output the trailers.
> They still have to parse the "key: value" lines, but at
> least they can ignore all of the other corner cases.
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
> +test_expect_success 'only-trailers omits non-trailer in middle of block' '
> +       cat >expected <<-\EOF &&
> +               Signed-off-by: nobody <nobody@nowhere>
> +               Signed-off-by: somebody <somebody@somewhere>
> +               sign: A U Thor <author@xxxxxxxxxxx>
> +       EOF
> +       git interpret-trailers --only-trailers >actual <<-\EOF &&
> +               subject
> +
> +               it is important that the trailers below are signed-off-by
> +               so that they meet the "25% trailers Git knows about" heuristic
> +
> +               Signed-off-by: nobody <nobody@nowhere>
> +               this is not a trailer

Please see 60ef86a162 (trailer: support values folded to multiple lines,
2016-10-21), maybe we also want to test for

VeryLongTrailerKey: long text with spaces and breaking
    the line.

For those parsing the trailer do we unbreak the line?
Such that one line equals one trailer? or is the user of the parsed
output expected to take care of this themselves?