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

Re: bug? illegal text in commit log

From
René Scharfe <l.s.r@web.de>
Date
Feb 7, 2020, 20:31 UTC
Message-ID
<c67e59a2-0f81-8311-e14c-f27876e45cf0@web.de>
In-Reply-To
<20200207110216.ppf5aksfkam54bip@ti.com>
Am 07.02.20 um 12:02 schrieb Pratyush Yadav:
Show 21 quoted lines
> On 06/02/20 08:45AM, Junio C Hamano wrote:
>> René Scharfe <l.s.r@web.de> writes:
>>
>>> Like a Lines: header specifying the number of lines in the commit message?
>>
>> The only part of the workflow that can count the number reliably is
>> format-patch.  But the output of format-patch is designed to be
>> edited further, and expecting users to adjust the number when they
>> make such an edit is a bit too much.
>
> I haven't thought this through, but I'll throw the idea out anyway:
>
> How about counting lines in the diff (the one generated by format-patch,
> not the one in the commit message) instead of lines in the commit
> message? This way, the bottom n lines in the mail (barring the
> signature) are the diff contents.
>
> I personally have often edited the commit message and added comments
> below the '---' line in the patches output by format-patch, but I rarely
> ever manually edit the diff. It is just really easy to corrupt the patch
> when you manually edit it.

That's a good idea from a usability point of view. However, mailinfo() parses patches line by line. It doesn't know the total number of lines until it's done. (It would if the Lines header from RFC 1036 was mandatory for emails; RFC 2076 says it's "not standardized for use in e-mail".) It cannot easily go back at that point.

Reading the whole message into a buffer or a temporary file would be an option, but that would give up the nice property that patches are streamed.

René
Previous: Pratyush YadavNext: Junio C Hamano
Message 13 of 14 in “bug? illegal text in commit log”
  1. Michael S. TsirkinFeb 4, 2020
  2. René ScharfeFeb 4, 2020
  3. Junio C HamanoFeb 4, 2020
  4. Michael S. TsirkinFeb 6, 2020
  5. Junio C HamanoFeb 6, 2020
  6. Junio C HamanoFeb 6, 2020
  7. René ScharfeFeb 6, 2020
  8. Junio C HamanoFeb 7, 2020
  9. René ScharfeFeb 7, 2020
  10. Jeff KingFeb 12, 2020
  11. Michael S. TsirkinFeb 6, 2020
  12. Pratyush YadavFeb 7, 2020
  13. René ScharfeFeb 7, 2020
  14. Junio C HamanoFeb 7, 2020

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.