From: Eric Wong <e@80x24.org>
To: Junio C Hamano <gitster@pobox.com>, Florian Weimer <fweimer@redhat.com>
Cc: git@vger.kernel.org
Subject: [PATCH v2] rebase: use mboxrd format to avoid split errors
Date: Sat, 18 Nov 2017 01:01:16 +0000 [thread overview]
Message-ID: <20171118010116.GA17169@starla> (raw)
In-Reply-To: <6a036339-d57d-4cc8-acfc-4e1786763a80@redhat.com>
Sorry, I forgot about this for a while :x
Florian Weimer <fweimer@redhat.com> wrote:
> On 10/08/2017 11:30 PM, Eric Wong wrote:
> >diff --git a/git-rebase--am.sh b/git-rebase--am.sh
<snip, identical change below>
> My context is slightly different, but I added the mboxrd options manually to
> both commands, and it fixes my test case.
>
> I'm still wondering if I have to be on the lookout for similar issues with
> different strings.
I don't think theres other issues with different strings,
"From " lines are the one known ambiguity problem with mbox and
thus the reason mboxrd was created.
Below is an updated patch which adds a test case:
---------8<---------
Subject: [PATCH] rebase: use mboxrd format to avoid split errors
The mboxrd format allows the use of embedded "From " lines in
commit messages without being misinterpreted by mailsplit
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Eric Wong <e@80x24.org>
---
git-rebase--am.sh | 2 ++
t/t3400-rebase.sh | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 6e64d40d6f..14c50782e0 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -53,6 +53,7 @@ else
git format-patch -k --stdout --full-index --cherry-pick --right-only \
--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
+ --pretty=mboxrd \
$git_format_patch_opt \
"$revisions" ${restrict_revision+^$restrict_revision} \
>"$GIT_DIR/rebased-patches"
@@ -83,6 +84,7 @@ else
fi
git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \
+ --patch-format=mboxrd \
$allow_rerere_autoupdate \
${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches"
ret=$?
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index f5fd15e559..8ac58d5ea5 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -255,4 +255,26 @@ test_expect_success 'rebase commit with an ancient timestamp' '
grep "author .* 34567 +0600$" actual
'
+test_expect_success 'rebase with "From " line in commit message' '
+ git checkout -b preserve-from master~1 &&
+ cat >From_.msg <<EOF &&
+Somebody embedded an mbox in a commit message
+
+This is from so-and-so:
+
+From a@b Mon Sep 17 00:00:00 2001
+From: John Doe <nobody@example.com>
+Date: Sat, 11 Nov 2017 00:00:00 +0000
+Subject: not this message
+
+something
+EOF
+ >From_ &&
+ git add From_ &&
+ git commit -F From_.msg &&
+ git rebase master &&
+ git log -1 --pretty=format:%B >out &&
+ test_cmp From_.msg out
+'
+
test_done
--
EW
prev parent reply other threads:[~2017-11-18 1:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-08 18:24 Special strings in commit messages Florian Weimer
2017-10-08 21:30 ` Eric Wong
2017-10-09 13:38 ` Florian Weimer
2017-11-18 1:01 ` Eric Wong [this message]
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=20171118010116.GA17169@starla \
--to=e@80x24.org \
--cc=fweimer@redhat.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.