Skip to content

Commit b1bb02d

Browse files
committed
Merge branch 'jc/maint-mailinfo-mime-attr'
When "git am" is fed an input that has multiple "Content-type: ..." header, it did not grok charset= attribute correctly. * jc/maint-mailinfo-mime-attr: mailinfo: do not concatenate charset= attribute values from mime headers
2 parents ff91dbb + 176943b commit b1bb02d

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

builtin/mailinfo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ static int slurp_attr(const char *line, const char *name, struct strbuf *attr)
160160
const char *ends, *ap = strcasestr(line, name);
161161
size_t sz;
162162

163-
if (!ap) {
164-
strbuf_setlen(attr, 0);
163+
strbuf_setlen(attr, 0);
164+
if (!ap)
165165
return 0;
166-
}
167166
ap += strlen(name);
168167
if (*ap == '"') {
169168
ap++;

t/t5100-mailinfo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
1111
'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
1212
last=`cat last` &&
1313
echo total is $last &&
14-
test `cat last` = 16'
14+
test `cat last` = 17'
1515

1616
check_mailinfo () {
1717
mail=$1 opt=$2

t/t5100/info0017

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Author: A U Thor
2+
3+
Subject: A E I O U
4+
Date: Mon, 17 Sep 2012 14:23:44 -0700
5+

t/t5100/msg0017

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
New content here
2+

t/t5100/patch0017

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
diff --git a/foo b/foo
2+
index e69de29..d95f3ad 100644
3+
--- a/foo
4+
+++ b/foo
5+
@@ -0,0 +1 @@
6+
+New content

t/t5100/sample.mbox

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,3 +683,19 @@ index e69de29..d95f3ad 100644
683683
@@ -0,0 +1 @@
684684
+content
685685

686+
From nobody Mon Sep 17 00:00:00 2001
687+
From: A U Thor <[email protected]>
688+
Subject: A E I O U
689+
Date: Mon, 17 Sep 2012 14:23:44 -0700
690+
MIME-Version: 1.0
691+
Content-Type: text/plain; charset="iso-2022-jp"
692+
Content-type: text/plain; charset="UTF-8"
693+
694+
New content here
695+
696+
diff --git a/foo b/foo
697+
index e69de29..d95f3ad 100644
698+
--- a/foo
699+
+++ b/foo
700+
@@ -0,0 +1 @@
701+
+New content

0 commit comments

Comments
 (0)