Subject: Re: Trailers Containing Underscore or Dot Characters

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 15 Nov 2024 08:42:37 +0100

On Thu, Nov 14, 2024 at 07:31:20AM +0900, Junio C Hamano wrote:
> Christian Couder <[email-masked]> writes:
> 
> >> Date:   Wed Nov 13 08:28:19 2024 +0300
> >>     Test
> >>     test_hoge: fuga:
> >>     test.hoge: fuga:
> >>     test-hoge: fuga
> >> ```
> >>
> >> What's different between what you expected and what actually happened?
> >>
> >> The one for `--trailer "test-hoge: fuga"` is finished with nothing.
> >> But The others for ones which have "_" or "." are finished with ":".
> >
> > Yeah, that's because '-' is allowed in trailer keys while '_' and '.' are not.
> 
> Thanks for responding.
> 
> I did not offhand recall seeing anywhere in our documentation set
> that defines what a valid trailer key looks like, so I went and read
> the interpret-trailers manual page and did not find any.  For
> example, is this a valid trailer line, even if we know '-' is
> "allowed in trailer keys"?
> 
> 	-test: fuga
> 
> Is this a valid trailer line, when your configuration adds '-' to
> the set of separator characters?
> 
> 	test- fuga
> 
> We do not even have an entry in the glossary for "trailer", and that
> probably is the first thing we need to fix.

The second thing we should be fixing is that git-interpret-trailers(1)
allows us to add invalid trailers:

    $ touch file
    $ git interpret-trailers --in-place file --trailer 'Valid-trailer: bar'
    $ git interpret-trailers --parse file
    Valid-trailer: bar
    $ git interpret-trailers --in-place file --trailer 'Invalid_trailer: bar'
    $ git interpret-trailers --parse file
    $ cat file

    Valid-trailer: bar
    Invalid_trailer: bar:

After the second invocation of git-interpret-trailers(1) it is unable to
find any trailers anymore due to the bogus format of the second trailer
line.

Patrick