Browse Source

Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header
maint
Junio C Hamano 16 years ago
parent
commit
e89b991a7f
  1. 28
      builtin-mailinfo.c
  2. 24
      t/t5100-mailinfo.sh
  3. 0
      t/t5100/empty
  4. 5
      t/t5100/info0012
  5. 5
      t/t5100/info0013
  6. 7
      t/t5100/msg0012
  7. 0
      t/t5100/msg0013
  8. 30
      t/t5100/patch0012
  9. 0
      t/t5100/patch0013
  10. 4
      t/t5100/rfc2047-info-0001
  11. 4
      t/t5100/rfc2047-info-0002
  12. 4
      t/t5100/rfc2047-info-0003
  13. 4
      t/t5100/rfc2047-info-0004
  14. 2
      t/t5100/rfc2047-info-0005
  15. 2
      t/t5100/rfc2047-info-0006
  16. 2
      t/t5100/rfc2047-info-0007
  17. 2
      t/t5100/rfc2047-info-0008
  18. 2
      t/t5100/rfc2047-info-0009
  19. 2
      t/t5100/rfc2047-info-0010
  20. 2
      t/t5100/rfc2047-info-0011
  21. 48
      t/t5100/rfc2047-samples.mbox
  22. 62
      t/t5100/sample.mbox

28
builtin-mailinfo.c

@ -430,13 +430,6 @@ static struct strbuf *decode_b_segment(const struct strbuf *b_seg) @@ -430,13 +430,6 @@ static struct strbuf *decode_b_segment(const struct strbuf *b_seg)
c -= 'a' - 26;
else if ('0' <= c && c <= '9')
c -= '0' - 52;
else if (c == '=') {
/* padding is almost like (c == 0), except we do
* not output NUL resulting only from it;
* for now we just trust the data.
*/
c = 0;
}
else
continue; /* garbage */
switch (pos++) {
@ -514,7 +507,25 @@ static int decode_header_bq(struct strbuf *it) @@ -514,7 +507,25 @@ static int decode_header_bq(struct strbuf *it)
rfc2047 = 1;

if (in != ep) {
strbuf_add(&outbuf, in, ep - in);
/*
* We are about to process an encoded-word
* that begins at ep, but there is something
* before the encoded word.
*/
char *scan;
for (scan = in; scan < ep; scan++)
if (!isspace(*scan))
break;

if (scan != ep || in == it->buf) {
/*
* We should not lose that "something",
* unless we have just processed an
* encoded-word, and there is only LWS
* before the one we are about to process.
*/
strbuf_add(&outbuf, in, ep - in);
}
in = ep;
}
/* E.g.
@ -860,6 +871,7 @@ static void handle_info(void) @@ -860,6 +871,7 @@ static void handle_info(void)
}
output_header_lines(fout, "Subject", hdr);
} else if (!memcmp(header[i], "From", 4)) {
cleanup_space(hdr);
handle_from(hdr);
fprintf(fout, "Author: %s\n", name.buf);
fprintf(fout, "Email: %s\n", email.buf);

24
t/t5100-mailinfo.sh

@ -11,7 +11,7 @@ test_expect_success 'split sample box' \ @@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
last=`cat last` &&
echo total is $last &&
test `cat last` = 11'
test `cat last` = 13'

for mail in `echo 00*`
do
@ -26,6 +26,28 @@ do @@ -26,6 +26,28 @@ do
'
done


test_expect_success 'split box with rfc2047 samples' \
'mkdir rfc2047 &&
git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
>rfc2047/last &&
last=`cat rfc2047/last` &&
echo total is $last &&
test `cat rfc2047/last` = 11'

for mail in `echo rfc2047/00*`
do
test_expect_success "mailinfo $mail" '
git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
echo msg &&
test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&
echo patch &&
test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&
echo info &&
test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info
'
done

test_expect_success 'respect NULs' '

git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&

0
t/t5100/empty

5
t/t5100/info0012

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
Author: Dmitriy Blinov
Email: bda@mnsspb.ru
Subject: Изменён список пакетов необходимых для сборки
Date: Wed, 12 Nov 2008 17:54:41 +0300

5
t/t5100/info0013

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
Author: A U Thor
Email: a.u.thor@example.com
Subject: a patch
Date: Fri, 9 Jun 2006 00:44:16 -0700

7
t/t5100/msg0012

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
textlive-* исправлены на texlive-*
docutils заменён на python-docutils

Действительно, оказалось, что rest2web вытягивает за собой
python-docutils. В то время как сам rest2web не нужен.

Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>

0
t/t5100/msg0013

30
t/t5100/patch0012

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
---
howto/build_navy.txt | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/howto/build_navy.txt b/howto/build_navy.txt
index 3fd3afb..0ee807e 100644
--- a/howto/build_navy.txt
+++ b/howto/build_navy.txt
@@ -119,8 +119,8 @@
- libxv-dev
- libusplash-dev
- latex-make
- - textlive-lang-cyrillic
- - textlive-latex-extra
+ - texlive-lang-cyrillic
+ - texlive-latex-extra
- dia
- python-pyrex
- libtool
@@ -128,7 +128,7 @@
- sox
- cython
- imagemagick
- - docutils
+ - python-docutils
#. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev
#. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::
--
1.5.6.5

0
t/t5100/patch0013

4
t/t5100/rfc2047-info-0001

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
Author: Keith Moore
Email: moore@cs.utk.edu
Subject: If you can read this you understand the example.

4
t/t5100/rfc2047-info-0002

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
Author: Olle Järnefors
Email: ojarnef@admin.kth.se
Subject: Time for ISO 10646?

4
t/t5100/rfc2047-info-0003

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
Author: Patrik Fältström
Email: paf@nada.kth.se
Subject: RFC-HDR care and feeding

4
t/t5100/rfc2047-info-0004

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
Author: Nathaniel Borenstein (םולש ןב ילטפנ)
Email: nsb@thumper.bellcore.com
Subject: Test of new header generator

2
t/t5100/rfc2047-info-0005

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (a)

2
t/t5100/rfc2047-info-0006

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (a b)

2
t/t5100/rfc2047-info-0007

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (ab)

2
t/t5100/rfc2047-info-0008

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (ab)

2
t/t5100/rfc2047-info-0009

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (ab)

2
t/t5100/rfc2047-info-0010

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (a b)

2
t/t5100/rfc2047-info-0011

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Subject: (a b)

48
t/t5100/rfc2047-samples.mbox

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
From nobody Mon Sep 17 00:00:00 2001
From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>
To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
CC: =?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>
Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=

From nobody Mon Sep 17 00:00:00 2001
From: =?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>
To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se
Subject: Time for ISO 10646?

From nobody Mon Sep 17 00:00:00 2001
To: Dave Crocker <dcrocker@mordor.stanford.edu>
Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.se
From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>
Subject: Re: RFC-HDR care and feeding

From nobody Mon Sep 17 00:00:00 2001
From: Nathaniel Borenstein <nsb@thumper.bellcore.com>
(=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)
To: Greg Vaudreuil <gvaudre@NRI.Reston.VA.US>, Ned Freed
<ned@innosoft.com>, Keith Moore <moore@cs.utk.edu>
Subject: Test of new header generator
MIME-Version: 1.0
Content-type: text/plain; charset=ISO-8859-1

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?=)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?= b)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?=
=?ISO-8859-1?Q?b?=)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a_b?=)

From nobody Mon Sep 17 00:00:00 2001
Subject: (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)

62
t/t5100/sample.mbox

@ -2,7 +2,10 @@ @@ -2,7 +2,10 @@
From nobody Mon Sep 17 00:00:00 2001
From: A U Thor <a.u.thor@example.com>
From: A
U
Thor
<a.u.thor@example.com>
Date: Fri, 9 Jun 2006 00:44:16 -0700
Subject: [PATCH] a commit.

@ -501,3 +504,60 @@ index 3e5fe51..aabfe5c 100644 @@ -501,3 +504,60 @@ index 3e5fe51..aabfe5c 100644

--=-=-=--

From bda@mnsspb.ru Wed Nov 12 17:54:41 2008
From: Dmitriy Blinov <bda@mnsspb.ru>
To: navy-patches@dinar.mns.mnsspb.ru
Date: Wed, 12 Nov 2008 17:54:41 +0300
Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
X-Mailer: git-send-email 1.5.6.5
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: 8bit
Subject: [Navy-patches] [PATCH]
=?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
=?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
=?utf-8?b?0YHQsdC+0YDQutC4?=

textlive-* исправлены на texlive-*
docutils заменён на python-docutils

Действительно, оказалось, что rest2web вытягивает за собой
python-docutils. В то время как сам rest2web не нужен.

Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
---
howto/build_navy.txt | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/howto/build_navy.txt b/howto/build_navy.txt
index 3fd3afb..0ee807e 100644
--- a/howto/build_navy.txt
+++ b/howto/build_navy.txt
@@ -119,8 +119,8 @@
- libxv-dev
- libusplash-dev
- latex-make
- - textlive-lang-cyrillic
- - textlive-latex-extra
+ - texlive-lang-cyrillic
+ - texlive-latex-extra
- dia
- python-pyrex
- libtool
@@ -128,7 +128,7 @@
- sox
- cython
- imagemagick
- - docutils
+ - python-docutils
#. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev
#. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::
--
1.5.6.5
From nobody Mon Sep 17 00:00:00 2001
From: <a.u.thor@example.com> (A U Thor)
Date: Fri, 9 Jun 2006 00:44:16 -0700
Subject: [PATCH] a patch


Loading…
Cancel
Save