summaryrefslogtreecommitdiff
path: root/t/t4258-am-quoted-cr.sh
diff options
context:
space:
mode:
authorLibravatar Đoàn Trần Công Danh <congdanhqx@gmail.com>2021-05-10 00:12:13 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-05-10 15:06:22 +0900
commit59b519ab7e703ebdbad06bd9ba3cae6e55d880d0 (patch)
treea3d3aa43c7cbc681c60dd9d8a5df4a404b7266c3 /t/t4258-am-quoted-cr.sh
parentmailinfo: allow stripping quoted CR without warning (diff)
downloadtgif-59b519ab7e703ebdbad06bd9ba3cae6e55d880d0.tar.xz
am: learn to process quoted lines that ends with CRLF
In previous changes, mailinfo has learnt to process lines that decoded from base64 or quoted-printable, and ends with CRLF. Let's teach "am" that new trick, too. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4258-am-quoted-cr.sh')
-rwxr-xr-xt/t4258-am-quoted-cr.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t4258-am-quoted-cr.sh b/t/t4258-am-quoted-cr.sh
new file mode 100755
index 0000000000..fb5071f914
--- /dev/null
+++ b/t/t4258-am-quoted-cr.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+test_description='test am --quoted-cr=<action>'
+
+. ./test-lib.sh
+
+DATA="$TEST_DIRECTORY/t4258"
+
+test_expect_success 'setup' '
+ test_write_lines one two three >text &&
+ test_commit one text &&
+ test_write_lines one owt three >text &&
+ test_commit two text
+'
+
+test_expect_success 'am warn if quoted-cr is found' '
+ git reset --hard one &&
+ test_must_fail git am "$DATA/mbox" 2>err &&
+ grep "quoted CRLF detected" err
+'
+
+test_expect_success 'am --quoted-cr=strip' '
+ test_might_fail git am --abort &&
+ git reset --hard one &&
+ git am --quoted-cr=strip "$DATA/mbox" &&
+ git diff --exit-code HEAD two
+'
+
+test_expect_success 'am with config mailinfo.quotecr=strip' '
+ test_might_fail git am --abort &&
+ git reset --hard one &&
+ test_config mailinfo.quotedCr strip &&
+ git am "$DATA/mbox" &&
+ git diff --exit-code HEAD two
+'
+
+test_done