git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Hofstetter <phofstetter@sensational.ch>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: git-mailinfo doesn't stop parsing at the end of the header
Date: Wed, 18 Nov 2009 18:11:36 +0100	[thread overview]
Message-ID: <aa2993680911180911o7e3af804m4ebdc20096baa609@mail.gmail.com> (raw)
In-Reply-To: <20091118155154.GA15184@coredump.intra.peff.net>

Hello,

On Wed, Nov 18, 2009 at 4:51 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Nov 18, 2009 at 03:20:48PM +0100, Philip Hofstetter wrote:

>  1. Improve the header-finding heuristic to actually look for something
>     more sane, like "From:.*<.*@.*>" (I don't recall off the top of my
>     head which other headers we handle in this position. Probably
>     Date, too).

or at least don't prefer obviously invalid data over valid data that
has already been seen.

>  2. Give mailinfo a "--strict" mode to indicate that it is directly
>     parsing the output of format-patch, and not some random email. Use
>     --strict when invoking "git am" via "git rebase".

That would solve the problem too, though it feels like adding yet
another switch to guard against one specific issue. The purpose behind
options like this tends to get forgotten over time.

> As I explained above, there is a reason, but I don't think it's rude to
> have either of those lines. You were, after all, writing a commit
> message, not an email (and even if you were, it is a failure of the
> storage format if it can't represent your data correctly). So I think
> git is to blame here.

IMHO, another workable solution would be to reject a commit that later
can't be handled. That way the current attempts at getting an email
address can remain intact and the (much more) unlikely case that
somebody begins the commit message with from: will be caught before
damage is done.

So, just check that from-line for a valid email address at commit
time. If it is, ok. If not, treat it as an error and inform the user
that an invalid email address was given in the commit message.

Also, the error message by rebase (which is actually the message
printed by am) could have been a bit more helpful. If am fails during
a rebase, rebase could explicitly tell which commit am failed at. The
output I got made me suspect the problem to be in the first commit (as
that was the last one printed) when in fact it was in the second one
(which was not printed).

But that's just nit-picking.

Philip

  parent reply	other threads:[~2009-11-18 17:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 14:20 git-mailinfo doesn't stop parsing at the end of the header Philip Hofstetter
2009-11-18 15:51 ` Jeff King
2009-11-18 16:42   ` Jeff King
2009-11-18 22:45     ` [PATCH] git am/mailinfo: Don't look at in-body headers when rebasing Lukas Sandström
2009-11-18 23:47       ` Philip Hofstetter
2009-11-19  8:51         ` [PATCH v2] " Lukas Sandström
2009-11-19 15:36           ` Jeff King
2009-11-20 16:12             ` [PATCH] " Lukas Sandström
2009-11-18 17:11   ` Philip Hofstetter [this message]
2009-11-18 17:24     ` git-mailinfo doesn't stop parsing at the end of the header Jeff King
2009-11-18 17:46       ` Jakub Narebski
2009-11-18 18:42         ` Jeff King
2009-11-18 19:57       ` Philip Hofstetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa2993680911180911o7e3af804m4ebdc20096baa609@mail.gmail.com \
    --to=phofstetter@sensational.ch \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).