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

Re: [PATCH 1/3] pretty: support "mboxrd" output format

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 4, 2016, 00:19 UTC
Message-ID
<CAPig+cQ7y7J02+PVtdJywGEudOGXsy1jgadvVwBg5creiUv6zA@mail.gmail.com>
In-Reply-To
<CAPig+cTQkEb6K95aeJ9vNyJ=S+8x+JnCQAYSEzydXKzbq-+Yyg@mail.gmail.com>
On Fri, Jun 3, 2016 at 8:02 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 19 quoted lines
> On Fri, Jun 3, 2016 at 7:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Eric Sunshine <sunshine@sunshineco.com> writes:
>>
>>>>         static int is_mboxrd_from(const char *line) {
>>>>                 return starts_with(line + strspn(line, ">"), "From ");
>>>>         }
>>>>
>>>> is sufficiently high-level that no longer is scary, hopefully?
>>>
>>> That's nice and concise but unfortunately not useful for this case
>>> where we must respect the logical end-of-line (within the larger
>>> buffer), represented by line+linelen.
>>
>> Hmph, none of ">", "F", "r", "o", "m", or " " is "\n"; would eol
>> still be an issue?
>
> Ah right. Sorry for being slow.
>
> Your concise version of is_mboxrd_from() is a nice alternative, as well.

My only minor reservation is that it your concise version is still subtle with regard to not taking 'linelen' into account. At first glance, it looks like a bug that it doesn't consider the logical end-of-line, and someone reading the code has to put in extra effort to convince himself that the code works as intended.

For that reason, I have a bit of a preference for a version of is_mboxrd_from() which does take 'linelen' into account explicitly.

Previous: Eric SunshineNext: Junio C Hamano
Message 15 of 18 in “support mboxrd format”
  1. 0/3 support mboxrd formatEric Wong, May 30, 2016
  2. 1/3 pretty: support "mboxrd" output formatEric Wong, May 30, 2016
  3. Eric SunshineMay 31, 2016
  4. Eric WongMay 31, 2016
  5. Eric SunshineMay 31, 2016
  6. Eric WongMay 31, 2016
  7. Eric SunshineMay 31, 2016
  8. Eric SunshineMay 31, 2016
  9. Eric WongJun 2, 2016
  10. Eric SunshineJun 3, 2016
  11. Junio C HamanoJun 3, 2016
  12. Eric SunshineJun 3, 2016
  13. Junio C HamanoJun 3, 2016
  14. Eric SunshineJun 4, 2016
  15. Eric SunshineJun 4, 2016
  16. Junio C HamanoJun 4, 2016
  17. 2/3 mailsplit: support unescaping mboxrd messagesEric Wong, May 30, 2016
  18. 3/3 am: support --patch-format=mboxrdEric Wong, May 30, 2016

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.