@matheusbsbs / matheus-bagliano / commits / 33ee4cfb69
Fork 0

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. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 4, 2007 at 16:08 UTC 33ee4cfb6929c77307887bc2124eaeaf011892dc
8 files changed +40 -76
log-tree.c
+3 -3
@@ -186,7 +186,7 @@ void show_log(struct rev_info *opt, const char *sep)
186 snprintf(subject_buffer, sizeof(subject_buffer) - 1,
187 "%s"
188 "MIME-Version: 1.0\n"
189 - "Content-Type: multipart/mixed;\n"
189 + "Content-Type: multipart/mixed;"
190 " boundary=\"%s%s\"\n"
191 "\n"
192 "This is a multi-part message in MIME "
@@ -202,10 +202,10 @@ void show_log(struct rev_info *opt, const char *sep)
202
203 snprintf(buffer, sizeof(buffer) - 1,
204 "--%s%s\n"
205 - "Content-Type: text/x-patch;\n"
205 + "Content-Type: text/x-patch;"
206 " name=\"%s.diff\"\n"
207 "Content-Transfer-Encoding: 8bit\n"
208 - "Content-Disposition: %s;\n"
208 + "Content-Disposition: %s;"
209 " filename=\"%s.diff\"\n\n",
210 mime_boundary_leader, opt->mime_boundary,
211 sha1,
t/t4013-diff-various.sh
+1 -1
@@ -106,7 +106,7 @@ do
106 echo "\$ git $cmd"
107 git $cmd |
108 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
109 - -e "s/^\\( *boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
109 + -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
110 echo "\$"
111 } >"$actual" &&
112 if test -f "$expect"
t/t4013/diff.format-patch_--attach_--stdout_initial..master
+9 -18
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:01:00 +0000
5 Subject: [PATCH] Second
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit.
20 3 files changed, 5 insertions(+), 3 deletions(-)
21 delete mode 100644 file2
22 --------------g-i-t--v-e-r-s-i-o-n
24 -Content-Type: text/x-patch;
25 - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
23 +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
24 Content-Transfer-Encoding: 8bit
27 -Content-Disposition: attachment;
28 - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
25 +Content-Disposition: attachment; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
26
27 diff --git a/dir/sub b/dir/sub
28 index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <author@example.com>
63 Date: Mon, 26 Jun 2006 00:02:00 +0000
64 Subject: [PATCH] Third
65 MIME-Version: 1.0
69 -Content-Type: multipart/mixed;
70 - boundary="------------g-i-t--v-e-r-s-i-o-n"
66 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
67
68 This is a multi-part message in MIME format.
69 --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit
76 2 files changed, 5 insertions(+), 0 deletions(-)
77 create mode 100644 file1
78 --------------g-i-t--v-e-r-s-i-o-n
83 -Content-Type: text/x-patch;
84 - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
79 +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
80 Content-Transfer-Encoding: 8bit
86 -Content-Disposition: attachment;
87 - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
81 +Content-Disposition: attachment; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
82
83 diff --git a/dir/sub b/dir/sub
84 index 8422d40..cead32e 100644
@@ -115,8 +109,7 @@ From: A U Thor <author@example.com>
109 Date: Mon, 26 Jun 2006 00:03:00 +0000
110 Subject: [PATCH] Side
111 MIME-Version: 1.0
118 -Content-Type: multipart/mixed;
119 - boundary="------------g-i-t--v-e-r-s-i-o-n"
112 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
113
114 This is a multi-part message in MIME format.
115 --------------g-i-t--v-e-r-s-i-o-n
@@ -130,11 +123,9 @@ Content-Transfer-Encoding: 8bit
123 3 files changed, 9 insertions(+), 0 deletions(-)
124 create mode 100644 file3
125 --------------g-i-t--v-e-r-s-i-o-n
133 -Content-Type: text/x-patch;
134 - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
126 +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
127 Content-Transfer-Encoding: 8bit
136 -Content-Disposition: attachment;
137 - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
128 +Content-Disposition: attachment; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
129
130 diff --git a/dir/sub b/dir/sub
131 index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--attach_--stdout_initial..master^
+6 -12
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:01:00 +0000
5 Subject: [PATCH] Second
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit.
20 3 files changed, 5 insertions(+), 3 deletions(-)
21 delete mode 100644 file2
22 --------------g-i-t--v-e-r-s-i-o-n
24 -Content-Type: text/x-patch;
25 - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
23 +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
24 Content-Transfer-Encoding: 8bit
27 -Content-Disposition: attachment;
28 - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
25 +Content-Disposition: attachment; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
26
27 diff --git a/dir/sub b/dir/sub
28 index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <author@example.com>
63 Date: Mon, 26 Jun 2006 00:02:00 +0000
64 Subject: [PATCH] Third
65 MIME-Version: 1.0
69 -Content-Type: multipart/mixed;
70 - boundary="------------g-i-t--v-e-r-s-i-o-n"
66 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
67
68 This is a multi-part message in MIME format.
69 --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit
76 2 files changed, 5 insertions(+), 0 deletions(-)
77 create mode 100644 file1
78 --------------g-i-t--v-e-r-s-i-o-n
83 -Content-Type: text/x-patch;
84 - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
79 +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
80 Content-Transfer-Encoding: 8bit
86 -Content-Disposition: attachment;
87 - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
81 +Content-Disposition: attachment; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
82
83 diff --git a/dir/sub b/dir/sub
84 index 8422d40..cead32e 100644
t/t4013/diff.format-patch_--attach_--stdout_initial..side
+3 -6
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:03:00 +0000
5 Subject: [PATCH] Side
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -19,11 +18,9 @@ Content-Transfer-Encoding: 8bit
18 3 files changed, 9 insertions(+), 0 deletions(-)
19 create mode 100644 file3
20 --------------g-i-t--v-e-r-s-i-o-n
22 -Content-Type: text/x-patch;
23 - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
21 +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
22 Content-Transfer-Encoding: 8bit
25 -Content-Disposition: attachment;
26 - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
23 +Content-Disposition: attachment; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
24
25 diff --git a/dir/sub b/dir/sub
26 index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..master
+9 -18
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:01:00 +0000
5 Subject: [PATCH] Second
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit.
20 3 files changed, 5 insertions(+), 3 deletions(-)
21 delete mode 100644 file2
22 --------------g-i-t--v-e-r-s-i-o-n
24 -Content-Type: text/x-patch;
25 - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
23 +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
24 Content-Transfer-Encoding: 8bit
27 -Content-Disposition: inline;
28 - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
25 +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
26
27 diff --git a/dir/sub b/dir/sub
28 index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <author@example.com>
63 Date: Mon, 26 Jun 2006 00:02:00 +0000
64 Subject: [PATCH] Third
65 MIME-Version: 1.0
69 -Content-Type: multipart/mixed;
70 - boundary="------------g-i-t--v-e-r-s-i-o-n"
66 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
67
68 This is a multi-part message in MIME format.
69 --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit
76 2 files changed, 5 insertions(+), 0 deletions(-)
77 create mode 100644 file1
78 --------------g-i-t--v-e-r-s-i-o-n
83 -Content-Type: text/x-patch;
84 - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
79 +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
80 Content-Transfer-Encoding: 8bit
86 -Content-Disposition: inline;
87 - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
81 +Content-Disposition: inline; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
82
83 diff --git a/dir/sub b/dir/sub
84 index 8422d40..cead32e 100644
@@ -115,8 +109,7 @@ From: A U Thor <author@example.com>
109 Date: Mon, 26 Jun 2006 00:03:00 +0000
110 Subject: [PATCH] Side
111 MIME-Version: 1.0
118 -Content-Type: multipart/mixed;
119 - boundary="------------g-i-t--v-e-r-s-i-o-n"
112 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
113
114 This is a multi-part message in MIME format.
115 --------------g-i-t--v-e-r-s-i-o-n
@@ -130,11 +123,9 @@ Content-Transfer-Encoding: 8bit
123 3 files changed, 9 insertions(+), 0 deletions(-)
124 create mode 100644 file3
125 --------------g-i-t--v-e-r-s-i-o-n
133 -Content-Type: text/x-patch;
134 - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
126 +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
127 Content-Transfer-Encoding: 8bit
136 -Content-Disposition: inline;
137 - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
128 +Content-Disposition: inline; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
129
130 diff --git a/dir/sub b/dir/sub
131 index 35d242b..7289e35 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..master^
+6 -12
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:01:00 +0000
5 Subject: [PATCH] Second
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -21,11 +20,9 @@ This is the second commit.
20 3 files changed, 5 insertions(+), 3 deletions(-)
21 delete mode 100644 file2
22 --------------g-i-t--v-e-r-s-i-o-n
24 -Content-Type: text/x-patch;
25 - name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
23 +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
24 Content-Transfer-Encoding: 8bit
27 -Content-Disposition: inline;
28 - filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
25 +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff"
26
27 diff --git a/dir/sub b/dir/sub
28 index 35d242b..8422d40 100644
@@ -66,8 +63,7 @@ From: A U Thor <author@example.com>
63 Date: Mon, 26 Jun 2006 00:02:00 +0000
64 Subject: [PATCH] Third
65 MIME-Version: 1.0
69 -Content-Type: multipart/mixed;
70 - boundary="------------g-i-t--v-e-r-s-i-o-n"
66 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
67
68 This is a multi-part message in MIME format.
69 --------------g-i-t--v-e-r-s-i-o-n
@@ -80,11 +76,9 @@ Content-Transfer-Encoding: 8bit
76 2 files changed, 5 insertions(+), 0 deletions(-)
77 create mode 100644 file1
78 --------------g-i-t--v-e-r-s-i-o-n
83 -Content-Type: text/x-patch;
84 - name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
79 +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
80 Content-Transfer-Encoding: 8bit
86 -Content-Disposition: inline;
87 - filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
81 +Content-Disposition: inline; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff"
82
83 diff --git a/dir/sub b/dir/sub
84 index 8422d40..cead32e 100644
t/t4013/diff.format-patch_--inline_--stdout_initial..side
+3 -6
@@ -4,8 +4,7 @@ From: A U Thor <author@example.com>
4 Date: Mon, 26 Jun 2006 00:03:00 +0000
5 Subject: [PATCH] Side
6 MIME-Version: 1.0
7 -Content-Type: multipart/mixed;
8 - boundary="------------g-i-t--v-e-r-s-i-o-n"
7 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8
9 This is a multi-part message in MIME format.
10 --------------g-i-t--v-e-r-s-i-o-n
@@ -19,11 +18,9 @@ Content-Transfer-Encoding: 8bit
18 3 files changed, 9 insertions(+), 0 deletions(-)
19 create mode 100644 file3
20 --------------g-i-t--v-e-r-s-i-o-n
22 -Content-Type: text/x-patch;
23 - name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
21 +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
22 Content-Transfer-Encoding: 8bit
25 -Content-Disposition: inline;
26 - filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
23 +Content-Disposition: inline; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
24
25 diff --git a/dir/sub b/dir/sub
26 index 35d242b..7289e35 100644