Merge branch 'sb/transport-report-missing-submodule-on-stderr'
[gitweb.git] / t / t5100-mailinfo.sh
index e97cfb2ab838fc9d9ecf1a7d207d6316e11a63f5..1a5a546230b9d971594af754fa5f11e5decd3cef 100755 (executable)
@@ -9,9 +9,9 @@ test_description='git mailinfo and git mailsplit test'
 
 test_expect_success 'split sample box' \
        'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
-       last=`cat last` &&
+       last=$(cat last) &&
        echo total is $last &&
-       test `cat last` = 17'
+       test $(cat last) = 17'
 
 check_mailinfo () {
        mail=$1 opt=$2
@@ -23,7 +23,7 @@ check_mailinfo () {
 }
 
 
-for mail in `echo 00*`
+for mail in 00*
 do
        test_expect_success "mailinfo $mail" '
                check_mailinfo $mail "" &&
@@ -47,11 +47,11 @@ 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` &&
+       last=$(cat rfc2047/last) &&
        echo total is $last &&
-       test `cat rfc2047/last` = 11'
+       test $(cat rfc2047/last) = 11'
 
-for mail in `echo rfc2047/00*`
+for mail in rfc2047/00*
 do
        test_expect_success "mailinfo $mail" '
                git mailinfo -u $mail-msg $mail-patch <$mail >$mail-info &&
@@ -111,4 +111,35 @@ test_expect_success 'mailinfo on message with quoted >From' '
        test_cmp "$TEST_DIRECTORY"/t5100/quoted-from.expect quoted-from/msg
 '
 
+test_expect_success 'mailinfo unescapes with --mboxrd' '
+       mkdir mboxrd &&
+       git mailsplit -omboxrd --mboxrd \
+               "$TEST_DIRECTORY"/t5100/sample.mboxrd >last &&
+       test x"$(cat last)" = x2 &&
+       for i in 0001 0002
+       do
+               git mailinfo mboxrd/msg mboxrd/patch \
+                 <mboxrd/$i >mboxrd/out &&
+               test_cmp "$TEST_DIRECTORY"/t5100/${i}mboxrd mboxrd/msg
+       done &&
+       sp=" " &&
+       echo "From " >expect &&
+       echo "From " >>expect &&
+       echo >> expect &&
+       cat >sp <<-INPUT_END &&
+       From mboxrd Mon Sep 17 00:00:00 2001
+       From: trailing spacer <sp@example.com>
+       Subject: [PATCH] a commit with trailing space
+
+       From$sp
+       >From$sp
+
+       INPUT_END
+
+       git mailsplit -f2 -omboxrd --mboxrd <sp >last &&
+       test x"$(cat last)" = x1 &&
+       git mailinfo mboxrd/msg mboxrd/patch <mboxrd/0003 &&
+       test_cmp expect mboxrd/msg
+'
+
 test_done