Re: [PATCH 2/5] interpret-trailers: add an option to show only the trailers
On Wed, Aug 9, 2017 at 10:52 AM, Stefan Beller <sbeller@google.com> wrote:
Show 38 quoted lines
> On Wed, Aug 9, 2017 at 5:24 AM, Jeff King <peff@peff.net> 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@peff.net>
>> ---
> ...
>> +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@example.com>
>> + 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?\
Nevermind, 4/5 solves that problem.