From: Carl Worth <cworth@cworth.org>
To: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: Carl Worth <cworth@cworth.org>
Subject: [PATCH] Add a test for "git rebase" with a From_ line in the commit message
Date: Wed, 9 Jun 2010 10:29:17 -0700 [thread overview]
Message-ID: <1276104557-2025-1-git-send-email-cworth@cworth.org> (raw)
This test ensures that all tools underlying "git rebase", (such as
"git format-patch" and "git am"), collectively agree on a robust
escaping mechanism for a line in the commit message that looks like
an mbox separator.
Specifically, the problematic line begins with "From " and ends with a
timestamp in the form returned by the asctime function.
Signed-off-by: Carl Worth <cworth@cworth.org>
---
This test fails with git from origin/master but passes with my current
series of patches to implement mboxrd format in both format-patch and
mailsplit. This would also be a useful test even if some other robust
format were chosen other than mboxrd.
t/t3418-rebase-From_.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t3418-rebase-From_.sh
diff --git a/t/t3418-rebase-From_.sh b/t/t3418-rebase-From_.sh
new file mode 100755
index 0000000..c809fda
--- /dev/null
+++ b/t/t3418-rebase-From_.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Carl Worth
+#
+
+test_description='git rebase with a commit with a From_ line in it
+
+This test ensures that git rebase will not get confused by a commit
+that contains a line in the commit message that looks like a mbox
+separator (begins with "From " and ends with an asctime-like timestamp)
+'
+. ./test-lib.sh
+
+cat >msg <<EOF
+From_-line commit
+
+This crafty commit message contains a line that looks an awful lot
+like an mbox separator. This kind of thing has been known to happen,
+(often accidentally), but git rebase should still support it.
+
+Here's the tricky line:
+
+From 74df72aec0b959c3015f4d7f213453217cb21aed Mon Sep 17 00:00:00 2001
+
+EOF
+test_expect_success 'setup' '
+ test_commit A &&
+ test_commit B &&
+ echo "hello world" > file &&
+ git add file &&
+ git commit -F msg
+'
+
+test_expect_success 'git rebase replaying a commit with a From_ line' '
+ git rebase --onto A B
+'
+
+test_done
--
1.7.1.249.g74df7
reply other threads:[~2010-06-09 17:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1276104557-2025-1-git-send-email-cworth@cworth.org \
--to=cworth@cworth.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hpa@zytor.com \
/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).