git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] trailer: allow spaces in tokens

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Aug 18, 2022, 17:52 UTC
Message-ID
<20220818175216.3530525-1-jonathantanmy@google.com>
In-Reply-To
<xmqqo7whqyzs.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> Jonathan, do you remember if the "be stricter" was in a response to
> specific real world issues, or is this "we no longer allow whitespace"
> an unintended side effect of the change?
Rereading the relevant mailing list thread, I think it's a bit of both.
The sequence of events was as follows:
 - I made a patch set that changed sequencer.c (which, among other
   things, controls the behavior of "commit -s") to use
   interpret-trailers's functionality. This caused a change in the
   behavior of a "commit -s" unit test (the "I want to mention about
   Signed-off-by: here." one), because "commit -s" previously did not
   support spaces before the separator. [1]
 - You mentioned that perhaps we should tighten it back. [2]
 - I agreed and tightened it, but didn't change the documentation. [3]

[1] https://lore.kernel.org/git/a416ab9b-ff1f-9a71-3e58-60fd4f8a6b8e@google.com/ [2] https://lore.kernel.org/git/xmqqtwbroykt.fsf@gitster.mtv.corp.google.com/ [3] https://lore.kernel.org/git/cover.1478028700.git.jonathantanmy@google.com/

So the "real world issue" was a test in our test suite, and perhaps the side effect was unintended in that we wanted to preserve the behavior of "commit -s" but didn't think about other possible uses of interpret-trailers.

Show 8 quoted lines
> If the former, an equally valid "fix" to what Max reports here would
> be to add such a real world issue or two as new tests to demonostrate
> why allowing whitespaces was a mistake that hurts real-world workflow,
> and fix the documentation.
>
> I actually am suspecting it is the latter, only because we would have
> added a testcase to show why whitespaces in the trailer label is a
> bad idea in e4319562 if this was triggered by a real-world issue.

The "I want to mention about Signed-off-by: here." test might be a sufficient real-world issue.

Show 5 quoted lines
> I would say that it would be a disaster, if we took any random
> line with colon : in it in the middle of the commit message and
> mistook it as a trailer (like the line above), but since we do not
> allow paragraph breaks in the trailer block, as long as the message
> has a valid trailer block, it might not be a huge issue.  I dunno.

Yes, it would be fine if the paragraph was two or more lines long, but not if it's a single line.

Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 19 in “trailer: allow spaces in tokens”
  1. trailer: allow spaces in tokensMax Bernstein via GitGitGadget, Aug 18, 2022
  2. trailer: allow spaces in tokensMax Bernstein via GitGitGadget, Aug 18, 2022
  3. Junio C HamanoAug 18, 2022
  4. Jonathan TanAug 18, 2022
  5. Maxwell BernsteinAug 18, 2022
  6. Christian CouderAug 18, 2022
  7. Junio C HamanoAug 18, 2022
  8. Junio C HamanoAug 19, 2022
  9. Christian CouderAug 19, 2022
  10. Johannes SchindelinAug 22, 2022
  11. Documentation: clarify whitespace rules for trailersChristian Couder, Aug 23, 2022
  12. Junio C HamanoAug 24, 2022
  13. Christian CouderAug 25, 2022
  14. Junio C HamanoAug 25, 2022
  15. Documentation: clarify whitespace rules for trailersChristian Couder, Aug 30, 2022
  16. Junio C HamanoAug 30, 2022
  17. Junio C HamanoAug 18, 2022
  18. Jonathan TanAug 18, 2022
  19. Junio C HamanoAug 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.