From: Carl Worth <cworth@cworth.org>
To: git@vger.kernel.org
Cc: Carl Worth <cworth@cworth.org>
Subject: [PATCH 2/2] Add test from From_-line escaping.
Date: Tue, 8 Jun 2010 13:02:29 -0700 [thread overview]
Message-ID: <1276027349-4064-2-git-send-email-cworth@cworth.org> (raw)
In-Reply-To: <1276027349-4064-1-git-send-email-cworth@cworth.org>
As implemented in the previous commit. We test that when applying from an
mbox that all escaped From_ lines are properly unescaped. We also test that
when applying from an email message the unescaping does not occur.
Signed-off-by: Carl Worth <cworth@cworth.org>
---
t/t4152-am-From_.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)
create mode 100755 t/t4152-am-From_.sh
diff --git a/t/t4152-am-From_.sh b/t/t4152-am-From_.sh
new file mode 100755
index 0000000..02821ee
--- /dev/null
+++ b/t/t4152-am-From_.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+test_description='git am properly unescaping From_ lines'
+
+. ./test-lib.sh
+
+cat >msg <<EOF
+From_ lines
+
+This is a commit message that contains a From_ line, which is line
+that begins with the characters "From ". Get ready for it, now...
+From this time forward, we'll have no From_-line bugs.
+
+Additionally, we'll also test lines that are escaped versions of From_
+lines. These are lines that begin with one or more '>' characters that
+are then followed by the characters "From ". We want to ensure that
+none of these intentional '>' characters get swallowed. Let's try that
+with three variations, (with 1, 2, and 3 leading '>' characters):
+
+>From now on (with one leading '>')
+>>From there to here (with two leading '>' characters)
+>>>From Here to Eternity (with three leading '>' characters)
+
+EOF
+
+test_expect_success setup '
+ echo hello >file &&
+ git add file &&
+ test_tick &&
+ git commit -m first &&
+ git tag first &&
+ echo world >>file &&
+ git add file &&
+ test_tick &&
+ git commit -s -F msg &&
+ git tag second &&
+ git format-patch --stdout first | sed -e "1{p;d};s/^\(>*From \)/>\1/" > From_ &&
+ {
+ echo "X-Fake-Field: Line One" &&
+ echo "X-Fake-Field: Line Two" &&
+ echo "X-Fake-Field: Line Three" &&
+ git format-patch --stdout first | sed -e "1d"
+ } > From_.eml
+'
+
+test_expect_success 'am unescapes From_ lines from mbox' '
+ git checkout first &&
+ git am From_ &&
+ ! test -d .git/rebase-apply &&
+ test -z "$(git diff second)" &&
+ test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
+ test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
+'
+
+test_expect_success 'am does not unescape From_ lines from email' '
+ git checkout first &&
+ git am From_.eml &&
+ ! test -d .git/rebase-apply &&
+ test -z "$(git diff second)" &&
+ test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
+ test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
+'
+
+test_done
--
1.7.0.4
next prev parent reply other threads:[~2010-06-08 20:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87hbldjo0s.fsf@yoom.home.cworth.org>
2010-06-08 20:02 ` [PATCH 1/2] mailsplit: Remove any '>' characters used to escape From_ lines in mbox Carl Worth
2010-06-08 20:02 ` Carl Worth [this message]
2010-06-08 20:47 ` Make "git am" properly unescape lines matching ">>*From " Carl Worth
2010-06-08 20:54 ` H. Peter Anvin
2010-06-08 21:30 ` Carl Worth
2010-06-08 20:50 ` H. Peter Anvin
2010-06-08 21:52 ` Carl Worth
2010-06-08 22:10 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276027349-4064-2-git-send-email-cworth@cworth.org \
--to=cworth@cworth.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).