Skip to content

Commit 87f1b88

Browse files
jaysoffiangitster
authored andcommitted
mailinfo: feed only one line to handle_filter() for QP input
The function is intended to be fed one logical line at a time to inspect, but a QP encoded raw input line can have more than one lines, just like BASE64 encoded one. Quoting LF as =0A may be unusual but RFC2045 allows it. The issue was noticed and fixed by Jay Soffian. JC added a test to protect the fix from regressing later. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b20a60d commit 87f1b88

File tree

6 files changed

+45
-1
lines changed

6 files changed

+45
-1
lines changed

builtin-mailinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ static void handle_body(void)
818818

819819
switch (transfer_encoding) {
820820
case TE_BASE64:
821+
case TE_QP:
821822
{
822823
char *op = line;
823824

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. ../t5100/sample.mbox >last &&
1212
last=`cat last` &&
1313
echo total is $last &&
14-
test `cat last` = 8'
14+
test `cat last` = 9'
1515

1616
for mail in `echo 00*`
1717
do

t/t5100/info0009

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Author: F U Bar
2+
Email: f.u.bar@example.com
3+
Subject: updates
4+
Date: Mon, 17 Sep 2001 00:00:00 +0900
5+

t/t5100/msg0009

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This is to fix diff-format documentation.
2+

t/t5100/patch0009

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
2+
index b426a14..97756ec 100644
3+
--- a/Documentation/diff-format.txt
4+
+++ b/Documentation/diff-format.txt
5+
@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
6+
environment variable 'GIT_DIFF_OPTS'. For example, if you
7+
prefer context diff:
8+
9+
- GIT_DIFF_OPTS=-c git-diff-index -p $(cat .git/HEAD)
10+
+ GIT_DIFF_OPTS=-c git-diff-index -p HEAD
11+
12+
13+
2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the

t/t5100/sample.mbox

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,26 @@ Subject: [PATCH] another patch
407407

408408
Hey you forgot the patch!
409409

410+
From nobody Mon Sep 17 00:00:00 2001
411+
From: A U Thor <a.u.thor@example.com>
412+
Date: Mon, 17 Sep 2001 00:00:00 +0900
413+
Mime-Version: 1.0
414+
Content-Type: Text/Plain; charset=us-ascii
415+
Content-Transfer-Encoding: Quoted-Printable
416+
417+
=0A=0AFrom: F U Bar <f.u.bar@example.com>
418+
Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
419+
420+
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
421+
index b426a14..97756ec 100644
422+
--- a/Documentation/diff-format.txt
423+
+++ b/Documentation/diff-format.txt
424+
@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
425+
environment variable 'GIT_DIFF_OPTS'. For example, if you
426+
prefer context diff:
427+
=20
428+
- GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
429+
+ GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
430+
=20
431+
=20
432+
2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the

0 commit comments

Comments
 (0)