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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Wong committed
Nov 18, 2017 at 01:01 UTC
ae3b2b04bb88c8bbb298ceb5be634a3c0ba92159
2 files changed
+24
git-rebase--am.sh
+2
@@ -53,6 +53,7 @@ else
53
54
git format-patch -k --stdout --full-index --cherry-pick --right-only \
55
--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
56
+ --pretty=mboxrd \
57
$git_format_patch_opt \
58
"$revisions" ${restrict_revision+^$restrict_revision} \
59
>"$GIT_DIR/rebased-patches"
@@ -83,6 +84,7 @@ else
84
fi
85
86
git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \
87
+ --patch-format=mboxrd \
88
$allow_rerere_autoupdate \
89
${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches"
90
ret=$?
t/t3400-rebase.sh
+22
@@ -255,4 +255,26 @@ test_expect_success 'rebase commit with an ancient timestamp' '
255
grep "author .* 34567 +0600$" actual
256
'
257
258
+test_expect_success 'rebase with "From " line in commit message' '
259
+ git checkout -b preserve-from master~1 &&
260
+ cat >From_.msg <<EOF &&
261
+Somebody embedded an mbox in a commit message
262
+
263
+This is from so-and-so:
264
+
265
+From a@b Mon Sep 17 00:00:00 2001
266
+From: John Doe <nobody@example.com>
267
+Date: Sat, 11 Nov 2017 00:00:00 +0000
268
+Subject: not this message
269
+
270
+something
271
+EOF
272
+ >From_ &&
273
+ git add From_ &&
274
+ git commit -F From_.msg &&
275
+ git rebase master &&
276
+ git log -1 --pretty=format:%B >out &&
277
+ test_cmp From_.msg out
278
+'
279
+
280
test_done