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

Re: bug? illegal text in commit log

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 7, 2020, 21:12 UTC
Message-ID
<xmqqh8022jay.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<c67e59a2-0f81-8311-e14c-f27876e45cf0@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 9 quoted lines
> 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.
True, but we could do a two-pass approach, perhaps?  That is
 * The first pass does exactly the same as what today's code does,
   PLUS it prepares for the case where we thought the log message
   ended because we saw "diff -" or "Index: " before seeing "---",
   by scanning for the first "---"while running handle_patch().
   If there is no such "oops, a 'diff -' in the log message fooled
   us" event, we complete with what today's code does.
 * But if we detect such a case during the first pass, we run
   ourselves again with the same input and arguments, PLUS an extra,
   new option, which tells us that "we know '---' exists in the
   input and it *is* the patchbreak.  This of course can be done
   only when the standard input is seekable, but builtin/am.c does
   store the mail in a file, so...
Previous: René Scharfe
Message 14 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.