Re: git-am applies commit message diffs
From: Junio C Hamano <hidden>
Date: 2026-02-11 15:47:14
Jeff King [off-list ref] writes:
All that said, if the main goal is just avoiding accidental diffs in commit messages (and not worrying about truncation due to "---" in messages), there may be a simpler receiver-side solution. If the receiver expects the message to be generated by Git, then it will expect there to be a "---" line. And we will not expect any diff before then. So could we just have a "git am --strict" mode (and perhaps matching config option) that always looks for the "---" separator? It's not foolproof, but I suspect it would help with the worst cases of embedded diffs. And it's not that hard to implement.
Yup, if the payload is known to be generated by "git", which is much more likely these days than back when "git am" (or "git applymbox") was written, can ignore "Index:" and "diff -" when deciding when the log message part of a piece of e-mail ends. I like that approach.