git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-mailinfo doesn't stop parsing at the end of the header
@ 2009-11-18 14:20 Philip Hofstetter
  2009-11-18 15:51 ` Jeff King
  0 siblings, 1 reply; 13+ messages in thread
From: Philip Hofstetter @ 2009-11-18 14:20 UTC (permalink / raw)
  To: git

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

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

end of thread, other threads:[~2009-11-20 16:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` 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

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).