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

Re: [PATCH 0/6] getwholeline should clear the buffer upon EOF

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 23, 2026, 15:37 UTC
Message-ID
<xmqq4id7d0ep.fsf@gitster.g>
In-Reply-To
<20261122140347.41990-1-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> time.  Because the code that caused the existing bugs does not appear in
> any of these steps, the log messages of patches 2-4 instead give
> detailed walkthroughs and are rather long, which is another reason why
> the nature of this series discourages following the usual pattern and
> doing everything in one step.

By the way, I _could_ have instead called strbuf_reset() at strategic places in patches 2-4 to "fix" the bug without touching the root cause, i.e., strbuf_getwholeline(), and added test_expect_success tests. That way, the commit log messages for these steps did not have to be such a detailed walkthrough of how the bugs happen, simply because the code that make problematic decisions based on a wrong assumption can be read in the context of these changes. Which requires patch 5 that fixes the root cause to revert these tentative "fixes" to call strbuf_reset() which becomes unnecessary when strbuf_getwholeline() stops leaving the stale contents in the buffer upon feof().

I chose not to do so, as a series that adds some code in an early step and immediately removes the same code in a later step is awkward and wasteful.

Previous: Junio C Hamano
Message 8 of 8 in “getwholeline should clear the buffer upon EOF”
  1. 0/6 getwholeline should clear the buffer upon EOFJunio C Hamano, Nov 22, 2026
  2. 1/6 mailinfo: do not call handle_body() when headers end at EOFJunio C Hamano, Nov 22, 2026
  3. 2/6 t4201: demonstrate shortlog reusing stale buffer on EOFJunio C Hamano, Nov 22, 2026
  4. 3/6 t7301: demonstrate "clean -i" ask mode deleting past EOFJunio C Hamano, Nov 22, 2026
  5. 4/6 t9300: demonstrate fast-import re-parsing heredoc delimiter at EOFJunio C Hamano, Nov 22, 2026
  6. 5/6 strbuf_getwholeline(): clear strbuf upon EOFJunio C Hamano, Nov 22, 2026
  7. 6/6 t7301, t9300: test EOF loops fixed by clearing strbuf upon EOFJunio C Hamano, Nov 22, 2026
  8. Junio C HamanoNov 23, 2026

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.