Junio C Hamano posted a six-patch series about the strbuf_getwholeline() family of functions. When these see feof() on the input stream, they return EOF immediately without reading, which is intended. But they leave the caller's buffer untouched. Junio calls this not strictly wrong but an error-prone API contract.

Several callers assume the buffer is empty after EOF. The series documents the resulting bugs. In git clean -i, a pattern-filter loop can spin forever, and in ask_each_cmd() a "y" answer on an incomplete line deletes every remaining untracked item instead of stopping. In fast-import, a stale heredoc delimiter left in command_buf can be re-parsed as a file-change command and corrupt the commit's tree. In shortlog, stale contents give wrong output when input ends on an incomplete line. In mailinfo, a stale last header can be fed to handle_body() and leak headers such as Content-Type into the commit log.

The series is deliberately structured unusually. The patches for shortlog, clean -i and fast-import explain each bug and add tests marked test_expect_failure. The fix in patch 5 makes strbuf_getwholeline() clear the buffer on the fast EOF path, and those tests then become test_expect_success. A mailinfo fix is also included.

Junio's patch notes that the change could break existing callers that depend on the old behaviour. The excerpts show no review from others yet, so it is unclear whether other callers are affected.