]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5100-mailinfo.sh
Merge branch 'jk/clone-b'
[thirdparty/git.git] / t / t5100-mailinfo.sh
CommitLineData
4839c0b5
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
5be60078 6test_description='git mailinfo and git mailsplit test'
4839c0b5
JH
7
8. ./test-lib.sh
9
10test_expect_success 'split sample box' \
bfdbee98 11 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
4839c0b5
JH
12 last=`cat last` &&
13 echo total is $last &&
806d5e90 14 test `cat last` = 13'
4839c0b5
JH
15
16for mail in `echo 00*`
17do
bfdbee98
JH
18 test_expect_success "mailinfo $mail" '
19 git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
4839c0b5 20 echo msg &&
bfdbee98 21 test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail &&
4839c0b5 22 echo patch &&
bfdbee98 23 test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail &&
4839c0b5 24 echo info &&
bfdbee98
JH
25 test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail
26 '
4839c0b5
JH
27done
28
c32815f9
KS
29
30test_expect_success 'split box with rfc2047 samples' \
31 'mkdir rfc2047 &&
32 git mailsplit -orfc2047 "$TEST_DIRECTORY"/t5100/rfc2047-samples.mbox \
33 >rfc2047/last &&
34 last=`cat rfc2047/last` &&
35 echo total is $last &&
36 test `cat rfc2047/last` = 11'
37
38for mail in `echo rfc2047/00*`
39do
40 test_expect_success "mailinfo $mail" '
41 git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
42 echo msg &&
43 test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-msg &&
44 echo patch &&
45 test_cmp "$TEST_DIRECTORY"/t5100/empty $mail-patch &&
46 echo info &&
47 test_cmp "$TEST_DIRECTORY"/t5100/rfc2047-info-$(basename $mail) $mail-info
48 '
49done
50
cce8d6fd
JS
51test_expect_success 'respect NULs' '
52
bfdbee98
JH
53 git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&
54 test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&
cce8d6fd
JS
55 (cat 001 | git mailinfo msg patch) &&
56 test 4 = $(wc -l < patch)
57
58'
59
9aa23094
JH
60test_expect_success 'Preserve NULs out of MIME encoded message' '
61
bfdbee98
JH
62 git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&
63 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&
9aa23094 64 git mailinfo msg patch <00001 &&
bfdbee98 65 test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch
9aa23094
JH
66
67'
68
e9d7d10a
JK
69test_expect_success 'mailinfo on from header without name works' '
70
71 mkdir info-from &&
72 git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in &&
73 test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 &&
74 git mailinfo info-from/msg info-from/patch \
75 <info-from/0001 >info-from/out &&
76 test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out
77
78'
79
4839c0b5 80test_done