On Tue, Sep 13, 2016 at 10:54:47PM -0700, Junio C Hamano wrote:
> Jeff King <p...@peff.net> writes:
> > It has been a while since I looked at rfc2822, but aren't the quoting
> > and syntax rules different for addresses versus other headers? We would
> > not want to dequote a Subject header, I think.
> You're absolutely right. RFC2822 does not quite _want_ to dequote
> anything. As you pointed out in a separate message, we are the one
> who want to strip out "" quoting when mailinfo says
> Author: "Jeff King"
> to its standard output (aka "info"), and turn it into
> GIT_AUTHOR_NAME='Jeff King'
> and do so ONLY for the author name.
> So I would think it is the responsibility of the one that reads the
> "info" file that is produced by mailinfo to dequote the backslash
> thing if the mailinfo gave us
> Author: "Jeff \"Peff\" King"
The RFC makes a distinction between structured fields and unstructured
fields. Quoting would not even be necessary for unstructured fields
(like Subject), so yes, that those fields should be left alone.
Unstructures fields are subject, comments, keywords and optional fields,
the rest is considered structured.
Because the only field where this is a problem is the From field, I
think it would be safe to limit the unquoting just to that field.
My reasoning to do the unquoting here is because it's the RFC requires
the quoting in the first place.
I already noticed a bug in the current unquoting of the author when
adding a comment to the From: field.
From: "A U Thor" <a...@thor.com> (test)
When applied the the author of this patch shows up as:
Author: A U Thor" (test) <a...@thor.com>
So I agree with Jeff where he states that the surrounding quotes
should be removed, if that's not a problem for git.