git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Hofstetter <phofstetter@sensational.ch>
To: git@vger.kernel.org
Subject: git-mailinfo doesn't stop parsing at the end of the header
Date: Wed, 18 Nov 2009 15:20:48 +0100	[thread overview]
Message-ID: <aa2993680911180620g151d8a07t11144d150cd6e29e@mail.gmail.com> (raw)

Hello,

today, after working on a topic branch and trying to rebase it on top
of the updated master, the rebase failed, complaining about an invalid
email address.

Some investigating revealed an interesting quirk in git-mailinfo which
seems to be a bit too eager to extract author information: Instead of
just looking at the From:-Line in a mails header (git-rebase seems to
use git-am which in turn uses git-mailinfo), it searches for "from:"
*anywhere* in the mail and uses the last found information as the
source for the author information.

In this case, git-format-patch has generated a file that looks
something like this:

--------------8<---------------

From d28f21ea8ca64681ba7756417799ceea81ad6873 Mon Sep 17 00:00:00 2001
From: Foo Bar <foo@bar.com>
Date: Tue, 17 Nov 2009 15:27:25 +0100
Subject: blah, blah, blah

from:
- this is a
- list for stuff
---
 list/of/changed/files                   |    1 -
 list/of/changed/files2                  |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

the actual diff down here

--------------8<---------------

And when you feed this into mailinfo, this is what you get:

pilif@celes ~/git % git mailinfo /dev/null /dev/null < somepatch.patch
Author:
Email:
Subject: blah, blah, blah
Date: Tue, 17 Nov 2009 15:27:25 +0100

pilif@celes ~/git %

and consequently, anything that depends on the correct author being
extracted then fails.

While I know it's rude to have a line beginning with "from:" (and it's
even ruder to have a line beginning with "from "), IMHO the header
ends at the first blank line and I see no reason to extract author
information past the header.

And if this is in fact intended behavior, it should probably not be
permitted to create a commit that later on can't be rebased or applied
using git-am.

I had a look at the source of git-mailinfo to fix it myself, but this
thing does too much for my minimal knowledge in C.

Philip

-- 
Sensational AG
Giesshübelstrasse 62c, Postfach 1966, 8021 Zürich
Tel. +41 43 544 09 60, Mobile  +41 79 341 01 99
info@sensational.ch, http://www.sensational.ch

             reply	other threads:[~2009-11-18 14:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 14:20 Philip Hofstetter [this message]
2009-11-18 15:51 ` git-mailinfo doesn't stop parsing at the end of the header 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   ` git-mailinfo doesn't stop parsing at the end of the header Philip Hofstetter
2009-11-18 17:24     ` 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=aa2993680911180620g151d8a07t11144d150cd6e29e@mail.gmail.com \
    --to=phofstetter@sensational.ch \
    --cc=git@vger.kernel.org \
    /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).