git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* In-body from headers ignored
@ 2017-02-05 21:45 Liam Breck
  2017-02-05 23:43 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Liam Breck @ 2017-02-05 21:45 UTC (permalink / raw)
  To: git

git format-patch & send-email generate the in-body From header.

git am recognizes it.

git commit & format-patch & send-email ignore it. (The latter two will
add a new header above an extant one.) Is there a rationale for this?

If not, maybe this is a bug?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: In-body from headers ignored
  2017-02-05 21:45 In-body from headers ignored Liam Breck
@ 2017-02-05 23:43 ` Junio C Hamano
  2017-02-06  0:08   ` Liam Breck
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2017-02-05 23:43 UTC (permalink / raw)
  To: Liam Breck; +Cc: git

Liam Breck <liam@networkimprov.net> writes:

> git format-patch & send-email generate the in-body From header.
>
> git am recognizes it.
>
> git commit & format-patch & send-email ignore it. (The latter two will
> add a new header above an extant one.) Is there a rationale for this?

I may be misunderstanding you, but I am guessing that you are
expecting

	$ GIT_AUTHOR_NAME="Liam Breck" GIT_AUTHOR_EMAIL='liam@n.net' \
	git commit -m 'The title of the patch

	From: Somebody Else <somebody@else.xz>
	Subject: The real title of the patch

	This is the (true) first line of the body of the message.'

to record a commit object that would give

	$ git cat-file commit HEAD
	tree ....
	parent ....
	author Somebody Else <somebody@else.xz> ....
	committer ...

	The real title of the patch

	This is the (true) first line of the body of the message.

and seeing that the real author is still you, the title is "The real
title of the patch", and the first paragraph of the body consists of
these two lines that begin with "From: and "Subject:".

This is very much deliberate.  "git commit" does not care if the
second paragraph in the body of the message resembles e-mail
headers, because it is a command that can be used by people who do
not even e-mail patches.

"git format-patch" and "git am" are all about passing the commit
between people over e-mail, and they know that the second paragraph
can have "From:", "Subject:" or "Date:" to override what "am"
obtains from the header lines of the e-mail that carried the
message, because the e-mail headers can be different (e.g. you may
be forwarding somebody else's e-mail but you may not be able to
forge the real "From:" line to your MUA/MTA) from what you really
want to use.  On the receiving end, "am" tells "mailinfo" program to
inspect the message body with "--inbody-headers" option.  After
"mailinfo" inspects the message, "am" invokes the underlying
machinery to actually make the commit (which corresponds to "git
commit"), but at that point the invoked "git commit" does not even
see these in-body header lines.  That is how division of labor
between these layers of the commands are structured.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: In-body from headers ignored
  2017-02-05 23:43 ` Junio C Hamano
@ 2017-02-06  0:08   ` Liam Breck
  0 siblings, 0 replies; 3+ messages in thread
From: Liam Breck @ 2017-02-06  0:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Sun, Feb 5, 2017 at 3:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Liam Breck <liam@networkimprov.net> writes:
>
>> git format-patch & send-email generate the in-body From header.
>>
>> git am recognizes it.
>>
>> git commit & format-patch & send-email ignore it. (The latter two will
>> add a new header above an extant one.) Is there a rationale for this?
>
> I may be misunderstanding you, but I am guessing that you are
> expecting
>...
> and seeing that the real author is still you, the title is "The real
> title of the patch", and the first paragraph of the body consists of
> these two lines that begin with "From: and "Subject:".
>
> This is very much deliberate.  "git commit" does not care if the
> second paragraph in the body of the message resembles e-mail
> headers, because it is a command that can be used by people who do
> not even e-mail patches.
> ...

Hi, thanks for the detailed reply :-)

OK, that resolves my Q about git commit.

But should not git format-patch & send-email detect an extant in-body
From or Subject header?

Suppose I need to forward a patchset and cannot amend the commits in
git? Or that a patchset author is not the copyright holder, whom I
want to be logged as the author upstream?

There is a workaround: delete the From headers in the patches, but I
was looking for a command-line option or alternate default behavior
:-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-06  0:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-05 21:45 In-body from headers ignored Liam Breck
2017-02-05 23:43 ` Junio C Hamano
2017-02-06  0:08   ` Liam Breck

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).