Re: git-am applies commit message diffs
From: Florian Weimer <hidden>
Date: 2026-02-06 08:59:39
* Jacob Keller:
It seems like a good idea to me to improve the format patch output and the git am patch splitting to somehow try and detect the end of a valid commit message and not treat it as a patch content, but I am really uncertain how to go about doing so safely without risking backwards compatibility (modifying format-patch to insert a marker that properly denotes end of commit would cause issues with older versions of git, so we need to use some marker that a well formatted patch already does.
Isn't the format-patch output already unambiguous because the sequence of diffs is preceeded by the non-diff statistics section, and only then the commit message follows? It's just not possible to process this correctly in one pass because only at the end of the input, you know that you have just seen the to-be-applied diffs. The other tool to look at is git rebase. There have been problems with the lack of "From " encoding in commit messages in the past, which caused rebases to fail due to commit message contents (but I can totally imagine that this might have resulted in commit injection with more carefully crafted commit messages). Thanks, Florian