# git-mailinfo munges the patch?

6 messages from 2007-03-29 to 2007-03-29. Participants: Junio C Hamano, Don Zickus, Linus Torvalds.
Thread: https://gitlist.dev/t/7476

## Junio C Hamano, 2007-03-29 20:18

Subject: git-mailinfo munges the patch?
Message-ID: <7v1wj74xck.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v1wj74xck.fsf%40assigned-by-dhcp.cox.net

```
I noticed that the new mailinfo when splitting a message into
cover letter and the patch text seems to munge the patch text,
applying the same "if content-type is not there then assume
latin-1 and recode to utf-8" logic that is applied to the commit
log message.  That munging should not be done to the patch text,
and it appears the current code botches it.

I am a bit too busy with day job today and haven't had a chance
to look into this problem fully, but 1.5.0.3 does not seem to
have this problem but post 87ab7992 mailinfo is problematic.

```

## Don Zickus, 2007-03-29 20:53

Subject: Re: git-mailinfo munges the patch?
Message-ID: <20070329205357.GF11029@redhat.com>
URL: https://gitlist.dev/e/20070329205357.GF11029%40redhat.com
In-Reply-To: <7v1wj74xck.fsf@assigned-by-dhcp.cox.net>

```
On Thu, Mar 29, 2007 at 01:18:51PM -0700, Junio C Hamano wrote:
> I noticed that the new mailinfo when splitting a message into
> cover letter and the patch text seems to munge the patch text,
> applying the same "if content-type is not there then assume
> latin-1 and recode to utf-8" logic that is applied to the commit
> log message.  That munging should not be done to the patch text,
> and it appears the current code botches it.

Ok.  I see what you are saying with the old code.  Sorry about that.  Do
you have a sample file that I can play with to test my fix?

Cheers,
Don

```

## Linus Torvalds, 2007-03-29 21:19

Subject: Re: git-mailinfo munges the patch?
Message-ID: <Pine.LNX.4.64.0703291417250.6730@woody.linux-foundation.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0703291417250.6730%40woody.linux-foundation.org
In-Reply-To: <20070329205357.GF11029@redhat.com>

```


On Thu, 29 Mar 2007, Don Zickus wrote:
> 
> Ok.  I see what you are saying with the old code.  Sorry about that.  Do
> you have a sample file that I can play with to test my fix?

On that note - here's an unrelated simple case that the old mailinfo got 
right, but the new one seems to screw up: multiple Subject: lines.

The old one would make later Subject: lines override the earlier ones, and 
I depended on that when I fix up peoples emails to me manually (you 
wouldn't believe how bad explanations or subject lines people use for 
perfectly good patches ;)

The current mailinfo seems to just take the first one. 

		Linus

```

## Junio C Hamano, 2007-03-29 21:24

Subject: Re: git-mailinfo munges the patch?
Message-ID: <7vejn73fqg.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vejn73fqg.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070329205357.GF11029@redhat.com>

```
Don Zickus <dzickus@redhat.com> writes:

> On Thu, Mar 29, 2007 at 01:18:51PM -0700, Junio C Hamano wrote:
>> I noticed that the new mailinfo when splitting a message into
>> cover letter and the patch text seems to munge the patch text,
>> applying the same "if content-type is not there then assume
>> latin-1 and recode to utf-8" logic that is applied to the commit
>> log message.  That munging should not be done to the patch text,
>> and it appears the current code botches it.
>
> Ok.  I see what you are saying with the old code.  Sorry about that.  Do
> you have a sample file that I can play with to test my fix?

Attached are two files.

The first one is to be split with git-mailsplit and then
processed with git-mailinfo; I just tried to make sure what I
expect to see as the output is given by 1.5.0 but not with the
current 'master'.

The second one is a bundle of the repository the test data comes
from.  You could use it like this:

	$ mkdir foo && cd foo && git init
        $ git pull ../sample.bdl master

The repository has one branch, 'master', with two commits on
it.  The first one creates an empty file 'a', and the second one
adds a line to the file, which has a Spanish "tilde on top of N"
in it, and the contents of the file is encoded in ISO 8859-1.

The commit message of the second one is plain ascii but it could
be in UTF-8.

The point is that patch can have payload from different files
that are possibly in different encodings, so shoud really be
treated as binary data without mangling.

Thanks.


```

## Don Zickus, 2007-03-29 21:52

Subject: Re: git-mailinfo munges the patch?
Message-ID: <20070329215248.GG11029@redhat.com>
URL: https://gitlist.dev/e/20070329215248.GG11029%40redhat.com
In-Reply-To: <Pine.LNX.4.64.0703291417250.6730@woody.linux-foundation.org>

```
On Thu, Mar 29, 2007 at 02:19:26PM -0700, Linus Torvalds wrote:
> 
> 
> On Thu, 29 Mar 2007, Don Zickus wrote:
> > 
> > Ok.  I see what you are saying with the old code.  Sorry about that.  Do
> > you have a sample file that I can play with to test my fix?
> 
> On that note - here's an unrelated simple case that the old mailinfo got 
> right, but the new one seems to screw up: multiple Subject: lines.
> 
> The old one would make later Subject: lines override the earlier ones, and 
> I depended on that when I fix up peoples emails to me manually (you 
> wouldn't believe how bad explanations or subject lines people use for 
> perfectly good patches ;)

I see what happened.  The old code allowed rewriting of the mail headers
but blocked rewriting of the inbody headers.  For some reason I thought it
was by accident that the mail headers were allow to be rewritten.  Oops.
:(

I wrote the code to have both header types block rewriting.  I'll change
that.  

Cheers,
Don

```

## Don Zickus, 2007-03-29 21:53

Subject: Re: git-mailinfo munges the patch?
Message-ID: <20070329215325.GH11029@redhat.com>
URL: https://gitlist.dev/e/20070329215325.GH11029%40redhat.com
In-Reply-To: <7vejn73fqg.fsf@assigned-by-dhcp.cox.net>

```
On Thu, Mar 29, 2007 at 02:24:39PM -0700, Junio C Hamano wrote:
> Don Zickus <dzickus@redhat.com> writes:
> 
> > On Thu, Mar 29, 2007 at 01:18:51PM -0700, Junio C Hamano wrote:
> >> I noticed that the new mailinfo when splitting a message into
> >> cover letter and the patch text seems to munge the patch text,
> >> applying the same "if content-type is not there then assume
> >> latin-1 and recode to utf-8" logic that is applied to the commit
> >> log message.  That munging should not be done to the patch text,
> >> and it appears the current code botches it.
> >
> > Ok.  I see what you are saying with the old code.  Sorry about that.  Do
> > you have a sample file that I can play with to test my fix?
> 
> Attached are two files.

Thanks.  I'll play with them later tonight.

Cheers,
Don

```
