summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-06 10:50:18 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-06 10:50:18 -0700
commitace8ebbcf5f07a5519cbeb0ae0571d8b40222e34 (patch)
treecb7b4bf9560d6751816f1ac79caaccf27611aa25 /t/t4014-format-patch.sh
parent1273738f05dedc63865085deb5d1fb8816ff809c (diff)
parent4d03c18a3ea18138c24d379ccc25e219a36ca1ef (diff)
downloadgit-ace8ebbcf5f07a5519cbeb0ae0571d8b40222e34.tar.gz
Merge branch 'jk/format-patch-quote-special-in-from'
* jk/format-patch-quote-special-in-from: pretty: quote rfc822 specials in email addresses Conflicts: pretty.c t/t4014-format-patch.sh
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index a7060b75be..045cee312c 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -808,4 +808,47 @@ test_expect_success 'format-patch wraps non-quotable headers' '
sed -n "/^From: /p; /^ /p; /^$/q" <patch >from &&
test_cmp expect from
'
+
+check_author() {
+ echo content >>file &&
+ git add file &&
+ GIT_AUTHOR_NAME=$1 git commit -m author-check &&
+ git format-patch --stdout -1 >patch &&
+ grep ^From: patch >actual &&
+ test_cmp expect actual
+}
+
+cat >expect <<'EOF'
+From: "Foo B. Bar" <author@example.com>
+EOF
+test_expect_success 'format-patch quotes dot in headers' '
+ check_author "Foo B. Bar"
+'
+
+cat >expect <<'EOF'
+From: "Foo \"The Baz\" Bar" <author@example.com>
+EOF
+test_expect_success 'format-patch quotes double-quote in headers' '
+ check_author "Foo \"The Baz\" Bar"
+'
+
+cat >expect <<'EOF'
+From: =?UTF-8?q?"F=C3=B6o=20B.=20Bar"?= <author@example.com>
+EOF
+test_expect_success 'rfc2047-encoded headers also double-quote 822 specials' '
+ check_author "Föo B. Bar"
+'
+
+cat >expect <<'EOF'
+Subject: header with . in it
+EOF
+test_expect_success 'subject lines do not have 822 atom-quoting' '
+ echo content >>file &&
+ git add file &&
+ git commit -m "header with . in it" &&
+ git format-patch -k -1 --stdout >patch &&
+ grep ^Subject: patch >actual &&
+ test_cmp expect actual
+'
+
test_done