From: Junio C Hamano Date: Wed, 26 Aug 2026 20:31:10 GMT Subject: Re: [PATCH] apply: avoid leaking abandoned git-header state Message-ID: In-Reply-To: <20260702041759.51572-1-zhihao.yao@njit.edu> Zephyr Yao writes: > When find_header() sees a "diff --git" line, it calls > parse_git_diff_header() to parse the git-style extended header. That parser > updates the caller's struct patch as it goes, filling in the default name, > old/new names, and new/delete state. > > But not every "diff --git" line found while scanning is ultimately accepted > as the patch header. If parse_git_diff_header() returns a length that covers > only the "diff --git" line, find_header() continues scanning for another > header. In that case the partially parsed git-header state must not interfere > with the later traditional "---" / "+++" header. This patch has gathered no response. Perhaps the e-mail received no reply because it was sent in early July around the holiday, or perhaps nobody was interested in the topic. In any case, I am cleaning up the "What's cooking" report and noticed that this has been in the "Needs review" state for a long time. So I took a look. These cross checks are primarily sanity checks. Having the parser notice a discrepancy and abort is a good thing. The user is supposed to inspect the situation and fix a malformed patch (such as one containing a stray 'diff --git' header unrelated to the actual patch). So I do not think we want to apply this patch. Thanks.