Re: I need a `git format-patch --attach-complete' for RT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 29, 2010 at 07:25, Paolo Bonzini <bonzini@xxxxxxx> wrote:
> On 04/21/2010 02:22 PM, Ævar Arnfjörð Bjarmason wrote:
>>
>> I'm working with a system that doesn't play nice with git-format-patch
>> / git-send-email. When you send mail to RT (e.g. http://rt.perl.org/)
>> it'll always munge the original E-Mail, so inline patches won't
>> work. [...]It would be nicer if I could instead:
>>
>>     git format-patch --attach-complete origin..
>>     git send-email *.patch
>
> This is a bit underspecified.  What should the subject be?  Do you want to
> have something like --cover-letter but placing the messages after 00/NN in
> an attachment?

It should work exactly as if though you'd taken the *.patch file
generated by `git format-patch a..b` and attached it as a MIME
attachment in your mailer.

The subject of the E-Mail itself should be the same

I want it to work exactly like `git format-patch` does, except it
should attach the patch as a multipart MIME part. The content of the
message itself (a text/plain MIME part) should be the same as now,
except it should skip the actual patch.

Here's an example of how it should look, generated by GMail:

    MIME-Version: 1.0
    Date: Thu, 29 Apr 2010 10:00:18 +0000
    Subject: [PATCH] Don't ask the porters to fetch commits from a private URL
    From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= <avar@xxxxxxxx>
    Content-Type: multipart/mixed; boundary=00163649a453b0a1ef04855d3190

    --00163649a453b0a1ef04855d3190
    Content-Type: text/plain; charset=UTF-8

    git@xxxxxxxxxx:USERNAME/perl.git is only accessible to USERNAME (or
    collaborators), git://github.com/USERNAME/perl.git is available to
    everyone.
    ---
    See the attached patch for the changes described in the diffstat below.

     pod/perlrepository.pod |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)

    --00163649a453b0a1ef04855d3190
    Content-Type: text/x-patch; charset=US-ASCII;
    name="0001-Don-t-ask-the-porters-to-fetch-commits-from-a-privat.patch"
    Content-Disposition: attachment;
    filename="0001-Don-t-ask-the-porters-to-fetch-commits-from-a-privat.patch"
    Content-Transfer-Encoding: base64
    X-Att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luZm9ybWF0aW9uOgogCiAgIGh0dHA6Ly9naXRodWIuY29tL1VTRVJOQU1F
    L3BlcmwvdHJlZS9vcmFuZ2UKLSAgZ2l0QGdpdGh1Yi5jb206VVNFUk5BTUUvcGVybC5naXQgYnJh
    bmNoIG9yYW5nZQorICBnaXQ6Ly9naXRodWIuY29tL1VTRVJOQU1FL3BlcmwuZ2l0IGJyYW5jaCBv
    cmFuZ2UKIAogPWhlYWQxIE1lcmdpbmcgZnJvbSBhIGJyYW5jaCB2aWEgR2l0SHViCiAKLS0gCjEu
    Ny4xLnJjMQoK
    --00163649a453b0a1ef04855d3190--

For comparison this is what `git format-patch a..b` will give me now:

    From fb60e745fdab6c3df3d254b4c2a6939307d3f8a7 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= <avar@xxxxxxxx>
    Date: Tue, 20 Apr 2010 19:28:01 +0000
    Subject: [PATCH] Don't ask the porters to fetch commits from a private URL

    git@xxxxxxxxxx:USERNAME/perl.git is only accessible to USERNAME (or
    collaborators), git://github.com/USERNAME/perl.git is available to
    everyone.
    ---
     pod/perlrepository.pod |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/pod/perlrepository.pod b/pod/perlrepository.pod
    index 00dbbfa..cc87bde 100644
    --- a/pod/perlrepository.pod
    +++ b/pod/perlrepository.pod
    @@ -757,7 +757,7 @@ email (see L</SUBMITTING A PATCH>) with a
description of your changes
     and the following information:

       http://github.com/USERNAME/perl/tree/orange
    -  git@xxxxxxxxxx:USERNAME/perl.git branch orange
    +  git://github.com/USERNAME/perl.git branch orange

     =head1 Merging from a branch via GitHub

    --
    1.7.1.rc1

And this is what `git format-patch --attach a..b` gives you. It just
attaches the patch (`git diff`). Not its commit message:

    From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= <avar@xxxxxxxx>
    Date: Tue, 20 Apr 2010 19:28:01 +0000
    Subject: [PATCH] Don't ask the porters to fetch commits from a private URL
    Date: Wed, 21 Apr 2010 11:48:19 +0000
    MIME-Version: 1.0
    Content-Type: multipart/mixed; boundary="------------1.7.1.rc1"

    From: Ævar Arnfjörð Bjarmason <avar@xxxxxxxx>

    This is a multi-part message in MIME format.
    --------------1.7.1.rc1
    Content-Type: text/plain; charset=UTF-8; format=fixed
    Content-Transfer-Encoding: 8bit


    git@xxxxxxxxxx:USERNAME/perl.git is only accessible to USERNAME (or
    collaborators), git://github.com/USERNAME/perl.git is available to
    everyone.
    ---
     pod/perlrepository.pod |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)


    --------------1.7.1.rc1
    Content-Type: text/x-patch;
name="0001-Don-t-ask-the-porters-to-fetch-commits-from-a-privat.patch"
    Content-Transfer-Encoding: 8bit
    Content-Disposition: attachment;
filename="0001-Don-t-ask-the-porters-to-fetch-commits-from-a-privat.patch"

    diff --git a/pod/perlrepository.pod b/pod/perlrepository.pod
    index 7dd4c25..15809dc 100644
    --- a/pod/perlrepository.pod
    +++ b/pod/perlrepository.pod
    @@ -757,7 +757,7 @@ email (see L</SUBMITTING A PATCH>) with a
description of your changes
     and the following information:

       http://github.com/USERNAME/perl/tree/orange
    -  git@xxxxxxxxxx:USERNAME/perl.git branch orange
    +  git://github.com/USERNAME/perl.git branch orange

     =head1 Merging from a branch via GitHub


    --------------1.7.1.rc1--

> It seems easiest to write a small filter in Perl, but it could be added as
> an option to git-format-patch, maybe something like
> --cover-letter=attach-all.

Yeah it'd be easiest to write one in Perl, but it would have to be in
core so you could tell random contributors to send patches with the
built-in tools using the new option easily.

The relevant bits in builtin/log.c are scary :) With other projects I
don't think I'll be patching it myself very soon (if ever). But I'd be
very thankful if someone would code this up.

It would be very useful for projects with silly Email-to-Bugtracker
gateways. A lot of silly E-Mail system will destroy inline content,
but they generally leave MIME attachments alone.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]