Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Zephyr Yao <zot.zot.yao@gmail.com>
Cc: git@vger.kernel.org,  Zephyr Yao <zhihao.yao@njit.edu>,
	 Mahya SamDaliri <ms3539@njit.edu>,
	 Haotian Zhang <haotian.zhang@njit.edu>,
	 Martin Kellogg <martin.kellogg@njit.edu>
Subject: Re: [PATCH] apply: avoid leaking abandoned git-header state
Date: Wed, 26 Aug 2026 13:31:10 -0700	[thread overview]
Message-ID: <xmqqtsogei9d.fsf@gitster.g> (raw)
In-Reply-To: <20260702041759.51572-1-zhihao.yao@njit.edu> (Zephyr Yao's message of "Thu, 2 Jul 2026 00:17:59 -0400")

Zephyr Yao <zot.zot.yao@gmail.com> 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.

      reply	other threads:[~2026-08-26 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  4:17 [PATCH] apply: avoid leaking abandoned git-header state Zephyr Yao
2026-08-26 20:31 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtsogei9d.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=haotian.zhang@njit.edu \
    --cc=martin.kellogg@njit.edu \
    --cc=ms3539@njit.edu \
    --cc=zhihao.yao@njit.edu \
    --cc=zot.zot.yao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox