Search code examples
gitemailoutlookgit-patchgit-am

Using Git am when outlook is involved


I am using linux in a virtual machine but my host is windows with outlook installed. Currently when I receive emails containing git patches they pop up in my outlook.

How do I apply these patches? They are not sent as attachments, they are sent presumably through git send mail.

Can I set up my VM to recieve them in the VM mailbox? (so far no success)

Can I save the patches to a folder in a git am friendly format? so far i have been trying this angle, I thought, if I drag and drop the messages into a folder and then git am on that folder then it would work, however if i do this, outlook saves them as .msg instead of .eml and their doesnt seem to be a way to convert. I have tried save as text file but then i get either "Patch does not have a valid e-mail address" with git am or "trailing whitespace" with git apply. I am guessing that i could solve the whitespace issue by removing the windows line endings but it all seems a bit of a hack and as i am doing this as part of a commercial team i would like it to work properly.

-Thanks for any help, chris


Solution

  • The best solution I came up with comes from here:

    http://www.tldp.org/HOWTO/Outlook-to-Unix-Mailbox-2.html

    There is an alternate method on the next page, but I found this was relatively hassle free and not to painful to use on a semi-regular basis.

    Pre-requists

    • install Thunderbird on your windows machine
    • when you open it, choose "skip integration"
    • have a shared folder set up on your VM machine

    Method

    • Receive the patch emails in outlook
    • you may want to put them in a folder / filter
    • Open Thunderbird
    • Click the 3 lines in the top right -> Tools -> Import
    • Choose "Mail"
    • Choose "Outlook"
    • You will now have a folder with a name like "Outlook Import1"
    • In that you will have all your outlook email, in folders just like outlook
    • select all the patch emails, right-click->Save As-> choose your shared folder, click "select folder"
    • At this point you will have proper .eml files in your shared folder (instead of the .msg files that outlook would produce)
    • at this point you can run '''git am - ''' on that folder to apply all the patches

    Possible Improvements*

    • There is a possibility that if we created a shared folder to where the imports are saved we could use git AM on that, however that has not been successful for me yet and is a little more voodoo then i like.

    • This might be easier if we used Thunderbird instead of outlook, but i am not sure if that would be possible with Microsoft exchange.

    • If we had a script that converted .msg files to proper .eml files (with headers), we could remove the need for thunderbird, apparently there are unix tools for this The question is, would they be proper .eml files??