Thanks, Peff, for the explanation and the method to reproduce the issue.
The issue seems to be in mailinfo.c - this patch set addresses that, and I have
also included a test for "git am" in t/t4150-am.sh to show the effect of this
patch set on that command.