Re: [PATCH 0/9] trailer-parsing false positives
From: Junio C Hamano <hidden>
Date: 2018-08-23 18:31:00
Jeff King [off-list ref] writes:
So this turned into a bit of a rabbit hole. Here's what I have so far (which I think is not quite ready, but I wanted to start discussing). Issues (2) and (3) are actually the same issue. The caller that does the bogus appending for (2) is always append_signoff(). But it always has just a commit message (modulo some complications, which I'll get to in a minute), and so fixing it with respect to (3) magically solves (2). I.e., the code was simply not prepared for the case of "end of string is not end of trailers". But since that case cannot exist, we do not have to deal with it. :) Now here's the tricky part. I think patches 1-8 are mostly sensible.
Yeah, nothing that made me go "Huh?" in these 8 patches. Thanks.
So I think there may be further opportunities for cleanup here. I'm not sure if we'd need to retain this behavior for git-interpret-trailers. AFAICT it is not documented, and I suspect is mostly historical accident, and not anything anybody ever wanted.
I tend to think the behaviour was not designed but it "just happens to work that way".
If we do keep it by default, then the "--no-divider" option I added in patch 4 should probably get a more generic name and cover this. Something like "--verbatim-input".
Perhaps. Even if this is not covered, --verbatim-input would be a good name for the option ;-)
I'm going to sleep on it and see how I feel tomorrow. [1/9]: trailer: use size_t for string offsets [2/9]: trailer: use size_t for iterating trailer list [3/9]: trailer: pass process_trailer_opts to trailer_info_get() [4/9]: interpret-trailers: tighten check for "---" patch boundary [5/9]: interpret-trailers: allow suppressing "---" divider [6/9]: pretty, ref-filter: format %(trailers) with no_divider option [7/9]: sequencer: ignore "---" divider when parsing trailers [8/9]: append_signoff: use size_t for string offsets [9/9]: sequencer: handle ignore_footer when parsing trailers Documentation/git-interpret-trailers.txt | 10 +++- builtin/interpret-trailers.c | 1 + commit.c | 6 +-- commit.h | 2 +- pretty.c | 3 ++ ref-filter.c | 2 + sequencer.c | 20 ++++++-- sequencer.h | 9 +++- t/t4205-log-pretty-formats.sh | 23 +++++++++ t/t6300-for-each-ref.sh | 23 +++++++++ t/t7501-commit.sh | 16 ++++++ t/t7513-interpret-trailers.sh | 42 ++++++++++++++++ trailer.c | 62 +++++++++++++----------- trailer.h | 4 +- 14 files changed, 184 insertions(+), 39 deletions(-) -Peff