summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Eric Wong <e@80x24.org>2016-06-05 04:46:41 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-06-06 11:40:15 -0700
commitd9925d1a714a440f4063f64e1bd776194d2dd918 (patch)
tree9fa4ce3c6e7ece9ce5212e7e62820be0eb35973b /t
parentmailsplit: support unescaping mboxrd messages (diff)
downloadtgif-d9925d1a714a440f4063f64e1bd776194d2dd918.tar.xz
am: support --patch-format=mboxrd
Combined with "git format-patch --pretty=mboxrd", this should allow us to round-trip commit messages with embedded mbox "From " lines without corruption. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4150-am.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index b41bd17264..9ce9424d15 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -957,4 +957,24 @@ test_expect_success 'am -s unexpected trailer block' '
test_cmp expect actual
'
+test_expect_success 'am --patch-format=mboxrd handles mboxrd' '
+ rm -fr .git/rebase-apply &&
+ git checkout -f first &&
+ echo mboxrd >>file &&
+ git add file &&
+ cat >msg <<-\INPUT_END &&
+ mboxrd should escape the body
+
+ From could trip up a loose mbox parser
+ >From extra escape for reversibility
+ INPUT_END
+ git commit -F msg &&
+ git format-patch --pretty=mboxrd --stdout -1 >mboxrd1 &&
+ grep "^>From could trip up a loose mbox parser" mboxrd1 &&
+ git checkout -f first &&
+ git am --patch-format=mboxrd mboxrd1 &&
+ git cat-file commit HEAD | tail -n4 >out &&
+ test_cmp msg out
+'
+
test_done