{"thread":{"id":"45055","subject":"In-body from headers ignored","startedAt":"2017-02-05T21:45:44Z","lastAt":"2017-02-06T00:08:11Z","messageCount":3,"participants":["Liam Breck","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"310888","messageId":"CAKvHMgQLKccm2LcL4LGhz0afVthaS2gvEcLtoHX2TcDnr1npbw@mail.gmail.com","threadId":"45055","inReplyTo":null,"subject":"In-body from headers ignored","fromName":"Liam Breck","fromEmail":"liam@networkimprov.net","sentAt":"2017-02-05T21:45:39Z","receivedAt":"2017-02-05T21:45:44Z","isPatch":false,"sender":{"key":"liam@networkimprov.net","avatar":null},"body":"git format-patch & send-email generate the in-body From header.\n\ngit am recognizes it.\n\ngit commit & format-patch & send-email ignore it. (The latter two will\nadd a new header above an extant one.) Is there a rationale for this?\n\nIf not, maybe this is a bug?\n"},{"id":"310892","messageId":"xmqqa8a0431z.fsf@gitster.mtv.corp.google.com","threadId":"45055","inReplyTo":"CAKvHMgQLKccm2LcL4LGhz0afVthaS2gvEcLtoHX2TcDnr1npbw@mail.gmail.com","subject":"Re: In-body from headers ignored","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-05T23:43:04Z","receivedAt":"2017-02-05T23:43:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Liam Breck <liam@networkimprov.net> writes:\n\n> git format-patch & send-email generate the in-body From header.\n>\n> git am recognizes it.\n>\n> git commit & format-patch & send-email ignore it. (The latter two will\n> add a new header above an extant one.) Is there a rationale for this?\n\nI may be misunderstanding you, but I am guessing that you are\nexpecting\n\n\t$ GIT_AUTHOR_NAME=\"Liam Breck\" GIT_AUTHOR_EMAIL='liam@n.net' \\\n\tgit commit -m 'The title of the patch\n\n\tFrom: Somebody Else <somebody@else.xz>\n\tSubject: The real title of the patch\n\n\tThis is the (true) first line of the body of the message.'\n\nto record a commit object that would give\n\n\t$ git cat-file commit HEAD\n\ttree ....\n\tparent ....\n\tauthor Somebody Else <somebody@else.xz> ....\n\tcommitter ...\n\n\tThe real title of the patch\n\n\tThis is the (true) first line of the body of the message.\n\nand seeing that the real author is still you, the title is \"The real\ntitle of the patch\", and the first paragraph of the body consists of\nthese two lines that begin with \"From: and \"Subject:\".\n\nThis is very much deliberate.  \"git commit\" does not care if the\nsecond paragraph in the body of the message resembles e-mail\nheaders, because it is a command that can be used by people who do\nnot even e-mail patches.\n\n\"git format-patch\" and \"git am\" are all about passing the commit\nbetween people over e-mail, and they know that the second paragraph\ncan have \"From:\", \"Subject:\" or \"Date:\" to override what \"am\"\nobtains from the header lines of the e-mail that carried the\nmessage, because the e-mail headers can be different (e.g. you may\nbe forwarding somebody else's e-mail but you may not be able to\nforge the real \"From:\" line to your MUA/MTA) from what you really\nwant to use.  On the receiving end, \"am\" tells \"mailinfo\" program to\ninspect the message body with \"--inbody-headers\" option.  After\n\"mailinfo\" inspects the message, \"am\" invokes the underlying\nmachinery to actually make the commit (which corresponds to \"git\ncommit\"), but at that point the invoked \"git commit\" does not even\nsee these in-body header lines.  That is how division of labor\nbetween these layers of the commands are structured.\n\n"},{"id":"310893","messageId":"CAKvHMgTDVU+=uq7_oQzfnSNxhFPd75-Ah4BXOcRnZCgUwytPWA@mail.gmail.com","threadId":"45055","inReplyTo":"xmqqa8a0431z.fsf@gitster.mtv.corp.google.com","subject":"Re: In-body from headers ignored","fromName":"Liam Breck","fromEmail":"liam@networkimprov.net","sentAt":"2017-02-06T00:08:05Z","receivedAt":"2017-02-06T00:08:11Z","isPatch":false,"sender":{"key":"liam@networkimprov.net","avatar":null},"body":"On Sun, Feb 5, 2017 at 3:43 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Liam Breck <liam@networkimprov.net> writes:\n>\n>> git format-patch & send-email generate the in-body From header.\n>>\n>> git am recognizes it.\n>>\n>> git commit & format-patch & send-email ignore it. (The latter two will\n>> add a new header above an extant one.) Is there a rationale for this?\n>\n> I may be misunderstanding you, but I am guessing that you are\n> expecting\n>...\n> and seeing that the real author is still you, the title is \"The real\n> title of the patch\", and the first paragraph of the body consists of\n> these two lines that begin with \"From: and \"Subject:\".\n>\n> This is very much deliberate.  \"git commit\" does not care if the\n> second paragraph in the body of the message resembles e-mail\n> headers, because it is a command that can be used by people who do\n> not even e-mail patches.\n> ...\n\nHi, thanks for the detailed reply :-)\n\nOK, that resolves my Q about git commit.\n\nBut should not git format-patch & send-email detect an extant in-body\nFrom or Subject header?\n\nSuppose I need to forward a patchset and cannot amend the commits in\ngit? Or that a patchset author is not the copyright holder, whom I\nwant to be logged as the author upstream?\n\nThere is a workaround: delete the From headers in the patches, but I\nwas looking for a command-line option or alternate default behavior\n:-)\n"}]}