Re: git mailinfo with patch parser
From: Junio C Hamano <hidden>
Date: 2019-10-02 05:35:38
Florian Weimer [off-list ref] writes:
git mailinfo splits a message into headers, commit message, and patch text, but does not actually parse the patch text. As a result, the patch portion produced by git mailinfo can contain something that looks like a patch, but actually isn't.
Yes, mailinfo is about splitting the header, log message and the remainder, and parsing the remainder to use it as a patch text is left to the consumer of the "patch" file it produces.
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.