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

Re: git mailinfo with patch parser

From
FWFlorian Weimer <fw@deneb.enyo.de>
Date
Oct 2, 2019, 05:41 UTC
Message-ID
<878sq366wy.fsf@mid.deneb.enyo.de>
In-Reply-To
<xmqq1rvvhfq2.fsf@gitster-ct.c.googlers.com>
* Junio C. Hamano:
Show 15 quoted lines
>> Is there a way to get the patch data, as parsed by git apply or git
>> am, and dump it back in patch format, without actually applying the
>> patch to a working tree?
>
> So, "the patch data as used by apply" is what you get from mailinfo.
> If it is a patch that applies to what you have in the working tree
> and/or the index is something you can/must ask "git apply".  IOW,
> when "git mailinfo" stored in $GIT_DIR/rebase-apply/patch the
> "remainder" of the message, you could
>
> 	git apply --check [--index] $GIT_DIR/rebase-apply/patch
>
> to see if it is an OK patch.  If it is, then there is no need to
> further "dump it back in patch format"; what you just fed to "apply
> --check" is already in the patch format.

Yes, but that requires a fully patched up Git repository containing the right blobs.

We know from experience that it is easy for humans to misread patches and fail to notice that certain patch hunks are actually ignored by git apply and similar tools. If there was a way to feed the patch through the parser and serialize it back, these discrepancies would be more noticeable, I think. Any data ignored by git apply/git am would be missing from the output.

Previous: Junio C Hamano
Message 3 of 3 in “git mailinfo with patch parser”
  1. Florian WeimerOct 2, 2019
  2. Junio C HamanoOct 2, 2019
  3. Florian WeimerOct 2, 2019

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.