Creating attachments using git-format-patch
Hi,
I've been trying to start using git-format-patch together with git-send-email, but I've encountered some problems. The mailinglist I want to send the patches to, requires patches to be sent as attachments. So, I tried using the --attach option of git-format-patch.
However its output does not seem to generate output which Thunderbird or Mutt recognize as attachments. Has anyone noticed similar problems or am I using it incorrectly?
I'm doing it as follows:
takis@poseidon:/usr/local/src/ffmpeg-pi$ git-format-patch --attach HEAD^ 0001-Modify-av_pkt_dump-and-av_hex_dump-to-be-av_logish.patch takis@poseidon:/usr/local/src/ffmpeg-pi$ git-send-email 0001-Modify-av_pkt_dump-and-av_hex_dump-to-be-av_logish.patch
Mutt shows a message containing:
This is a multi-part message in MIME format. --------------1.5.0.1.226.g7bd59
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
...
--------------1.5.0.1.226.g7bd59
Content-Type: text/x-patch;
name="514f2915144861b6d69ef54bd8d392aa8b3a00e6.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="514f2915144861b6d69ef54bd8d392aa8b3a00e6.diff"
...
But it does not look like an attachment. Same happens when reading the email with Thunderbird: everything appears inline.
Any suggestions?
With friendly regards,
Takis
Quoted 5 lines · Panagiotis Issaris
I've been trying to start using git-format-patch together with git-send-email, but I've encountered some problems. The mailinglist I want to send the patches to, requires patches to be sent as attachments. So, I tried using the --attach option of git-format-patch.
Strictly speaking, I think --attach option is misnamed. It's sole purpose is to create a multipart/mixed whose first part is the commit log message and the second part is the patch text to help cases where the patch text is not UTF-8 but the log message is.
We mark the second part inline because it is easier to review if the patch is shown inline in MUA.
For now, I think you could edit "inline;" to "attachment;".
We could introduce a new option "--inline" that does what the current "--attach" does, and make "--attach" write "attachment;" instead of "inline;" there, but that changes the behaviour, and people who are used to use "--attach" to send out patches to mailing lists suddenly start sending more cumbersome-to-read variant, so...
Hi,
Quoted 6 lines · Junio C Hamano
We could introduce a new option "--inline" that does what the current "--attach" does, and make "--attach" write "attachment;" instead of "inline;" there, but that changes the behaviour, and people who are used to use "--attach" to send out patches to mailing lists suddenly start sending more cumbersome-to-read variant, so...
... so we should introduce an option "--no-inline"!
Ciao,
Dscho
Quoted 10 lines · Johannes Schindelin
Quoted 6 lines · Junio C Hamano
We could introduce a new option "--inline" that does what the current "--attach" does, and make "--attach" write "attachment;" instead of "inline;" there, but that changes the behaviour, and people who are used to use "--attach" to send out patches to mailing lists suddenly start sending more cumbersome-to-read variant, so...
... so we should introduce an option "--no-inline"!
Yes, but this time around I _think_ we should admit that the current option is misnamed and make it right.
From: Johannes Schindelin <[email protected]>
Date: Sun, 4 Mar 2007 00:12:06 +0100
Subject: [PATCH] format-patch: add --inline option and make --attach a true attachment
The existing --attach option did not create a true "attachment" but multipart/mixed with Content-Disposition: inline. It should have been with Content-Disposition: attachment.
Introduce --inline to add multipart/mixed that is inlined, and make --attach to create an attachement.
---
Quoted 6 lines · Junio C Hamano
Quoted 1 line · Johannes Schindelin
... so we should introduce an option "--no-inline"!
Yes, but this time around I _think_ we should admit that the current option is misnamed and make it right.
* I do not think existing users care too deeply, as a patch as an attachment has always been frowned upon in kernel and git mailing list _anyway_, even if they were inlined.
Documentation/git-format-patch.txt | 14 +++++++++++--- builtin-log.c | 16 ++++++++++++++-- log-tree.c | 6 ++++-- revision.h | 1 + 4 files changed, 30 insertions(+), 7 deletions(-)
Documentation/git-format-patch.txt +11 -3
@@ -9,7 +9,8 @@ git-format-patch - Prepare patches for e-mail submission SYNOPSIS -------- [verse] -'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread] +'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread] + [--attach[=<boundary>] | --inline[=<boundary>]] [-s | --signoff] [--diff-options] [--start-number <n>] [--in-reply-to=Message-Id] [--suffix=.<sfx>] [--ignore-if-in-upstream]
@@ -68,8 +69,15 @@ OPTIONS Print all commits to the standard output in mbox format, instead of creating a file for each one. ---attach:: - Create attachments instead of inlining patches. +--attach[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: attachment". + +--inline[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: inline". --thread:: Add In-Reply-To and References headers to make the second and
builtin-log.c +14 -2
@@ -482,10 +482,22 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)memcpy (add_signoff, committer, endpos - committer +1 ); add_signoff[endpos - committer +1 ] =0 ; } -else if (!strcmp (argv[i],"--attach" )) +else if (!strcmp (argv[i],"--attach" )) { rev.mime_boundary = git_version_string; -else if (!prefixcmp (argv[i],"--attach=" )) + rev.no_inline =1 ; + } +else if (!prefixcmp (argv[i],"--attach=" )) { + rev.mime_boundary = argv[i] +9 ; + rev.no_inline =1 ; + } +else if (!strcmp (argv[i],"--inline" )) { + rev.mime_boundary = git_version_string; + rev.no_inline =0 ; + } +else if (!prefixcmp (argv[i],"--inline=" )) { rev.mime_boundary = argv[i] +9 ; + rev.no_inline =0 ; + }else if (!strcmp (argv[i],"--ignore-if-in-upstream" )) ignore_if_in_upstream =1 ;else if (!strcmp (argv[i],"--thread" ))
log-tree.c +4 -2
@@ -205,10 +205,12 @@ void show_log(struct rev_info *opt, const char *sep)"Content-Type: text/x-patch;\n" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" -"Content-Disposition: inline;\n" +"Content-Disposition: %s;\n" " filename=\"%s.diff\"\n\n" , mime_boundary_leader, opt->mime_boundary, - sha1, sha1); + sha1, + opt->no_inline ?"attachment" :"inline" , + sha1); opt->diffopt.stat_sep = buffer; } }else if (opt->commit_format !=CMIT_FMT_USERFORMAT ) {
revision.h +1 -0
@@ -74,6 +74,7 @@ struct rev_info {const char *add_signoff;const char *extra_headers;const char *log_reencode; +int no_inline;/* Filter by commit log message */ struct grep_opt *grep_filter;
Signature · 1 line
1.5.0.2.864.ge1aa
Hi,
Junio C Hamano schreef:
Quoted 8 lines
The existing --attach option did not create a true "attachment" but multipart/mixed with Content-Disposition: inline. It should have been with Content-Disposition: attachment.
Introduce --inline to add multipart/mixed that is inlined, and make --attach to create an attachement.
[...]
The patch did not work for me until I modified it a bit. I've added a modified full patch and an incremental one.
The patch did not work for me in the sense that the patches still appeared as inline text in both Mutt (1.5.13) and Thunderbird (2 beta 2).
The email show up as being threaded in Mutt, but in Thunderbird they still do not show up threaded. (Others do show up threaded, such as this thread about git-format-patch attachments, so Thunderbird appears to work alright).
Documentation/git-format-patch.txt | 14 +++++++++++--- builtin-log.c | 16 ++++++++++++++-- log-tree.c | 10 ++++++---- revision.h | 1 + 4 files changed, 32 insertions(+), 9 deletions(-)
log-tree.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Thanks for the quick response and help! :-)
With friendly regards,
Takis
Documentation/git-format-patch.txt +11 -3
@@ -9,7 +9,8 @@ git-format-patch - Prepare patches for e-mail submission SYNOPSIS -------- [verse] -'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread] +'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread] + [--attach[=<boundary>] | --inline[=<boundary>]] [-s | --signoff] [--diff-options] [--start-number <n>] [--in-reply-to=Message-Id] [--suffix=.<sfx>] [--ignore-if-in-upstream]
@@ -68,8 +69,15 @@ OPTIONS Print all commits to the standard output in mbox format, instead of creating a file for each one. ---attach:: - Create attachments instead of inlining patches. +--attach[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: attachment". + +--inline[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: inline". --thread:: Add In-Reply-To and References headers to make the second and
builtin-log.c +14 -2
@@ -482,10 +482,22 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)memcpy (add_signoff, committer, endpos - committer +1 ); add_signoff[endpos - committer +1 ] =0 ; } -else if (!strcmp (argv[i],"--attach" )) +else if (!strcmp (argv[i],"--attach" )) { rev.mime_boundary = git_version_string; -else if (!prefixcmp (argv[i],"--attach=" )) + rev.no_inline =1 ; + } +else if (!prefixcmp (argv[i],"--attach=" )) { + rev.mime_boundary = argv[i] +9 ; + rev.no_inline =1 ; + } +else if (!strcmp (argv[i],"--inline" )) { + rev.mime_boundary = git_version_string; + rev.no_inline =0 ; + } +else if (!prefixcmp (argv[i],"--inline=" )) { rev.mime_boundary = argv[i] +9 ; + rev.no_inline =0 ; + }else if (!strcmp (argv[i],"--ignore-if-in-upstream" )) ignore_if_in_upstream =1 ;else if (!strcmp (argv[i],"--thread" ))
log-tree.c +6 -4
@@ -186,7 +186,7 @@ void show_log(struct rev_info *opt, const char *sep)snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "
@@ -202,13 +202,15 @@ void show_log(struct rev_info *opt, const char *sep)snprintf (buffer,sizeof (buffer) -1 ,"--%s%s\n" -"Content-Type: text/x-patch;\n" +"Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" -"Content-Disposition: inline;\n" +"Content-Disposition: %s;" " filename=\"%s.diff\"\n\n" , mime_boundary_leader, opt->mime_boundary, - sha1, sha1); + sha1, + opt->no_inline ?"attachment" :"inline" , + sha1); opt->diffopt.stat_sep = buffer; } }else if (opt->commit_format !=CMIT_FMT_USERFORMAT ) {
revision.h +1 -0
@@ -74,6 +74,7 @@ struct rev_info {const char *add_signoff;const char *extra_headers;const char *log_reencode; +int no_inline;/* Filter by commit log message */ struct grep_opt *grep_filter;
log-tree.c +3 -3
@@ -186,7 +186,7 @@snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "
@@ -202,10 +202,10 @@ snprintf(buffer, sizeof(buffer) - 1, "--%s%s\n" - "Content-Type: text/x-patch;\n" + "Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" - "Content-Disposition: %s;\n" + "Content-Disposition: %s;" " filename=\"%s.diff\"\n\n", mime_boundary_leader, opt->mime_boundary, sha1,
Hi,
Quoted 10 lines · Panagiotis Issaris
Junio C Hamano schreef:
Quoted 8 lines
The existing --attach option did not create a true "attachment" but multipart/mixed with Content-Disposition: inline. It should have been with Content-Disposition: attachment.
Introduce --inline to add multipart/mixed that is inlined, and make --attach to create an attachement.
[...]
Thanks for the quick response and help! :-)
Sorry for the attachment in the previous email...
With friendly regards,
Takis
Documentation/git-format-patch.txt +11 -3
@@ -9,7 +9,8 @@ git-format-patch - Prepare patches for e-mail submission SYNOPSIS -------- [verse] -'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread] +'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread] + [--attach[=<boundary>] | --inline[=<boundary>]] [-s | --signoff] [--diff-options] [--start-number <n>] [--in-reply-to=Message-Id] [--suffix=.<sfx>] [--ignore-if-in-upstream]
@@ -68,8 +69,15 @@ OPTIONS Print all commits to the standard output in mbox format, instead of creating a file for each one. ---attach:: - Create attachments instead of inlining patches. +--attach[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: attachment". + +--inline[=<boundary>]:: + Create multipart/mixed attachment, the first part of + which is the commit message and the patch itself in the + second part, with "Content-Disposition: inline". --thread:: Add In-Reply-To and References headers to make the second and
builtin-log.c +14 -2
@@ -482,10 +482,22 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)memcpy (add_signoff, committer, endpos - committer +1 ); add_signoff[endpos - committer +1 ] =0 ; } -else if (!strcmp (argv[i],"--attach" )) +else if (!strcmp (argv[i],"--attach" )) { rev.mime_boundary = git_version_string; -else if (!prefixcmp (argv[i],"--attach=" )) + rev.no_inline =1 ; + } +else if (!prefixcmp (argv[i],"--attach=" )) { + rev.mime_boundary = argv[i] +9 ; + rev.no_inline =1 ; + } +else if (!strcmp (argv[i],"--inline" )) { + rev.mime_boundary = git_version_string; + rev.no_inline =0 ; + } +else if (!prefixcmp (argv[i],"--inline=" )) { rev.mime_boundary = argv[i] +9 ; + rev.no_inline =0 ; + }else if (!strcmp (argv[i],"--ignore-if-in-upstream" )) ignore_if_in_upstream =1 ;else if (!strcmp (argv[i],"--thread" ))
log-tree.c +6 -4
@@ -186,7 +186,7 @@ void show_log(struct rev_info *opt, const char *sep)snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "
@@ -202,13 +202,15 @@ void show_log(struct rev_info *opt, const char *sep)snprintf (buffer,sizeof (buffer) -1 ,"--%s%s\n" -"Content-Type: text/x-patch;\n" +"Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" -"Content-Disposition: inline;\n" +"Content-Disposition: %s;" " filename=\"%s.diff\"\n\n" , mime_boundary_leader, opt->mime_boundary, - sha1, sha1); + sha1, + opt->no_inline ?"attachment" :"inline" , + sha1); opt->diffopt.stat_sep = buffer; } }else if (opt->commit_format !=CMIT_FMT_USERFORMAT ) {
revision.h +1 -0
@@ -74,6 +74,7 @@ struct rev_info {const char *add_signoff;const char *extra_headers;const char *log_reencode; +int no_inline;/* Filter by commit log message */ struct grep_opt *grep_filter;
Quoted 7 lines · Panagiotis Issaris
The patch did not work for me in the sense that the patches still appeared as inline text in both Mutt (1.5.13) and Thunderbird (2 beta 2).
The email show up as being threaded in Mutt, but in Thunderbird they still do not show up threaded.
thread about git-format-patch attachments, so Thunderbird appears to work alright).
If the patch below is needed, then I doubt you can honestly say it appears to work...
Quoted 15 lines
diff -u
b/log-tree.cb/log-tree.clog-tree.c +1
-1@@ -186,7 +186,7 @@snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "@@ -202,10 +202,10 @@ snprintf(buffer, sizeof(buffer) - 1,
log-tree.c line 211
Quoted 10 lines
log-tree.c +2
-2"--%s%s\n" -"Content-Type: text/x-patch;\n" +"Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" -"Content-Disposition: %s;\n" +"Content-Disposition: %s;" " filename=\"%s.diff\"\n\n" , mime_boundary_leader, opt->mime_boundary, sha1,
But if it helps some implementations of MIME decoder without harming others, then I'd say why not. I just wanted to make sure it does not throw regression at others (for example by making the physical line too long for them to grok).
Hi,
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Panagiotis Issaris
The patch did not work for me in the sense that the patches still appeared as inline text in both Mutt (1.5.13) and Thunderbird (2 beta 2).
Quoted 7 lines
Quoted 4 lines
The email show up as being threaded in Mutt, but in Thunderbird they still do not show up threaded.
thread about git-format-patch attachments, so Thunderbird appears to work alright).If the patch below is needed, then I doubt you can honestly say it appears to work...
Well, here on Ubuntu using Mutt and Thunderbird the change below indeed makes the patches appear as attachments instead of inline text.
The e-mails not showing up as one thread is probably some other issue, or some misuse of me of git-format-patch and git-send-email.
I'm trying to get one e-mail sent with a header of [PATCH 00/16] with the other patches as attachments to that one summary e-mail. Initially they did not show up as being threaded in Thunderbird, but they did show up being threaded in Mutt. Now, with some experimentation, I managed to get them to show up in a thread in Thunderbird too, but unfortunately, now I am seeing the [PATCH 00/16] e-mail followed by one reply [PATCH 01/16] and all others are replies to [PATCH 01/16] instead of [PATCH 00/16]. Or by further experimentation, I got the [PATCH 00/16] e-mail sent with 14 replies correctly threaded, but two of them for some reader not ending up in the same thread...
git-format-patch --thread --attach -n origin..or2
git-send-email --no-chain-reply-to --to [email protected] --from \
[email protected] --subject "[PATCH 00/16] Various Doxygen related patches" \
--suppress-from --compose 00*patch
I've tried removing the --no-chain-reply and removing the --thread option of format-patch, but I never manage to get the mails sent in the way I want them to.
Anyway, I think my not-showing-up-as-a-thread issue is mainly because of me not understanding how to use it correctly :) and being unrelated to the patches-showing-up-inline-instead-of-as-attachments issue, which is really fixed here with the patch shown below.
In fact, I noticed that using --inline or --attach does not seem to make a difference for Mutt or Thunderbird, in both cases the emails appear to have attachments now :-/
The way I came to the patch below is by manually editing the e-mails generated by git-format-patch and sending them after each modification with git-send-email until I figured out what change made the patches appear as attachments in both email clients.
Quoted 14 lines
Quoted 14 lines
diff -u
b/log-tree.cb/log-tree.clog-tree.c +1
-1@@ -186,7 +186,7 @@snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "@@ -202,10 +202,10 @@
Quoted 16 lines
log-tree.c line 211
Quoted 11 lines
log-tree.c +2
-2snprintf(buffer, sizeof(buffer) - 1, "--%s%s\n" - "Content-Type: text/x-patch;\n" + "Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" - "Content-Disposition: %s;\n" + "Content-Disposition: %s;" " filename=\"%s.diff\"\n\n", mime_boundary_leader, opt->mime_boundary, sha1,But if it helps some implementations of MIME decoder without harming others, then I'd say why not. I just wanted to make sure it does not throw regression at others (for example by making the physical line too long for them to grok).
Of course, I fully understand your cautiousness.
With friendly regards,
Takis
Quoted 3 lines · Panagiotis Issaris
The patch did not work for me in the sense that the patches still appeared as inline text in both Mutt (1.5.13) and Thunderbird (2 beta 2).
Ok, I'll park this in 'next'.
-- >8 --
From: Junio C Hamano <[email protected]>
Date: Sun, 4 Mar 2007 16:08:04 -0800
Subject: [PATCH] format-patch --attach: not folding some long headers.
Panagiotis Issaris reports that some MUAs seem not to like folded "content-type" and "content-disposition" headers, so this makes format-patch --attach output to avoid them.
--- log-tree.c | 6 ++-- t/t4013-diff-various.sh | 2 +- ....format-patch_--attach_--stdout_initial..master | 27 ++++++------------- ...format-patch_--attach_--stdout_initial..master^ | 18 ++++--------- ...ff.format-patch_--attach_--stdout_initial..side | 9 ++---- ....format-patch_--inline_--stdout_initial..master | 27 ++++++------------- ...format-patch_--inline_--stdout_initial..master^ | 18 ++++--------- ...ff.format-patch_--inline_--stdout_initial..side | 9 ++---- 8 files changed, 40 insertions(+), 76 deletions(-)
log-tree.c +3 -3
@@ -186,7 +186,7 @@ void show_log(struct rev_info *opt, const char *sep)snprintf (subject_buffer,sizeof (subject_buffer) -1 ,"%s" "MIME-Version: 1.0\n" -"Content-Type: multipart/mixed;\n" +"Content-Type: multipart/mixed;" " boundary=\"%s%s\"\n" "\n" "This is a multi-part message in MIME "
@@ -202,10 +202,10 @@ void show_log(struct rev_info *opt, const char *sep) snprintf(buffer, sizeof(buffer) - 1, "--%s%s\n" - "Content-Type: text/x-patch;\n" + "Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" - "Content-Disposition: %s;\n" + "Content-Disposition: %s;" " filename=\"%s.diff\"\n\n", mime_boundary_leader, opt->mime_boundary, sha1,
t/t4013-diff-various.sh +1 -1
@@ -106,7 +106,7 @@ do echo "\$ git $cmd" git $cmd | sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ - -e "s/^\\( *boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/" + -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/" echo "\$" } >"$actual" && if test -f "$expect"
t/t4013/diff.format-patch_--attach_--stdout_initial..master +9 -18
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:01:00 +0000 Subject: [PATCH] Second MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit. 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Disposition: attachment; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:02:00 +0000 Subject: [PATCH] Third MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Disposition: attachment; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
@@ -115,8 +109,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:03:00 +0000 Subject: [PATCH] Side MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -130,11 +123,9 @@ Content-Transfer-Encoding: 8bit 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Disposition: attachment; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--attach_--stdout_initial..master^ +6 -12
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:01:00 +0000 Subject: [PATCH] Second MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit. 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Disposition: attachment; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:02:00 +0000 Subject: [PATCH] Third MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Disposition: attachment; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
t/t4013/diff.format-patch_--attach_--stdout_initial..side +3 -6
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:03:00 +0000 Subject: [PATCH] Side MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -19,11 +18,9 @@ Content-Transfer-Encoding: 8bit 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: attachment; - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Disposition: attachment; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..master +9 -18
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:01:00 +0000 Subject: [PATCH] Second MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit. 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:02:00 +0000 Subject: [PATCH] Third MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Disposition: inline; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
@@ -115,8 +109,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:03:00 +0000 Subject: [PATCH] Side MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -130,11 +123,9 @@ Content-Transfer-Encoding: 8bit 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Disposition: inline; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..master^ +6 -12
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:01:00 +0000 Subject: [PATCH] Second MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit. 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" diff --git a/dir/sub b/dir/sub index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:02:00 +0000 Subject: [PATCH] Third MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Disposition: inline; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" diff --git a/dir/sub b/dir/sub index 8422d40..cead32e 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..side +3 -6
@@ -4,8 +4,7 @@ From: A U Thor <[email protected]> Date: Mon, 26 Jun 2006 00:03:00 +0000 Subject: [PATCH] Side MIME-Version: 1.0 -Content-Type: multipart/mixed; - boundary="------------g-i-t--v-e-r-s-i-o-n" +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" This is a multi-part message in MIME format. --------------g-i-t--v-e-r-s-i-o-n
@@ -19,11 +18,9 @@ Content-Transfer-Encoding: 8bit 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 --------------g-i-t--v-e-r-s-i-o-n -Content-Type: text/x-patch; - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit -Content-Disposition: inline; - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Disposition: inline; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" diff --git a/dir/sub b/dir/sub index 35d242b..7289e35 100644
Signature · 1 line
1.5.0.2.878.g38f47
Hi,
Quoted 1 line · Junio C Hamano
Hopefully-Signed-off-by Johannes Schindelin <[email protected]>
Indeed-Signed-off-by: <ident>
Ciao,
Dscho
PATCH 1/1 format-patch: add --no-inline option
In reply to Johannes SchindelinSome projects have a "patches are not to be inlined" policy. Support these by adding an option to turn off inlined attachments.
---
On Sat, 3 Mar 2007, Johannes Schindelin wrote:
> ... so we should introduce an option "--no-inline"!
I.e. something like this. If you want this, I leave it to you to add a config variable to set the default (but then, you have to add an option "--inline", too!).
builtin-log.c | 2 ++ log-tree.c | 6 ++++-- revision.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)
builtin-log.c +2 -0
@@ -486,6 +486,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.mime_boundary = git_version_string; else if (!prefixcmp(argv[i], "--attach=")) rev.mime_boundary = argv[i] + 9; + else if (!strcmp(argv[i], "--no-inline")) + rev.no_inline = 1; else if (!strcmp(argv[i], "--ignore-if-in-upstream")) ignore_if_in_upstream =1 ; else if (!strcmp(argv[i], "--thread"))
log-tree.c +4 -2
@@ -205,10 +205,12 @@ void show_log(struct rev_info *opt, const char *sep)"Content-Type: text/x-patch;\n" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" -"Content-Disposition: inline;\n" +"Content-Disposition: %s;\n" " filename=\"%s.diff\"\n\n" , mime_boundary_leader, opt->mime_boundary, - sha1, sha1); + sha1, + opt->no_inline ?"attachment" :"inline" , + sha1); opt->diffopt.stat_sep = buffer; } }else if (opt->commit_format !=CMIT_FMT_USERFORMAT ) {
revision.h +1 -0
@@ -74,6 +74,7 @@ struct rev_info {const char *add_signoff;const char *extra_headers;const char *log_reencode; +int no_inline;/* Filter by commit log message */ struct grep_opt *grep_filter;