Git patch file attached to Outlook email gets modified by it

Tag: git , outlook , attachment , patch , email-attachments Author: wangwei110120 Date: 2012-03-05

I want to send .patch files that were generated by the git format-patch command via Outlook (I have to use Outlook where I work, no need to suggest me otherwise). The goal is only to have my code reviewed by a colleague before pushing my changes to the main repository. When I send my patch files as attachments, a > character gets inserted right at the beginning of my patch file.

Ex:

>From 7ff70407d24338e928fafcd89115f9844c21691b Mon Sep 17 00:00:00 2001
From: user <[email protected]>
Date: Wed, 21 Mar 2012 09:55:17 -0400
Subject: [PATCH] Blahblah...

This makes it impossible for git am to apply the patch on my colleague system.

I don't know (and don't know how to figure it out) how to validate if the modification occurs on the sending end or the receiving end.

Anyone knows what causes this? Are there some settings in Outlook that I should modify in order to avoid this?

Thanks in advance

Best Answer

This is related to an old Unix mailbox file format called mbox:

mboxo and mboxrd locate the message start by scanning for From lines that are typically found in the e-mail message header. If a "From " string occurs at the beginning of a line in either the headers or the body of a message (unlikely for the former for correctly formatted messages, but likely for the latter), the e-mail message must be modified before the message is stored in an mbox mailbox file or the line will be taken as a message boundary. This is typically done by prepending a greater-than sign:

>From my point of view...

In your situation, it's impossible (for us) to tell which component of your mail system might be prepending that >.

For use with Git, you can either delete the >, or you can probably delete the entire line (since the email message headers are not relevant to Git).

Other Answer1

Or you could try bouncing off of an smtp server you have?

git send-email --smtp-server=smtp.gmail.com *.patch

Would that work?

Or, you could look at http://alblue.bandlem.com/2011/12/git-tip-of-week-patches-by-email.html and try the git bundle command. . .

Are you only using github and windows in general, or can you at least use Cygwin for these command line options?