aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2010-01-25 16:33:59 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-25 16:43:36 -0800
commite3f67d30b20e49d8fc3eefe819808cba7998b060 (patch)
tree7582707fabddd36897bfa25504ad7c3e2ccefbbc /t
parentf4e6dcc36c37a6e62c8900ed657330356f6e2d8e (diff)
downloadgit-e3f67d30b20e49d8fc3eefe819808cba7998b060.tar.gz
git-e3f67d30b20e49d8fc3eefe819808cba7998b060.tar.xz
am: fix patch format detection for Thunderbird "Save As" emails
The patch detection wants to inspect all the headers of a rfc2822 message and ensure that they look like header fields. The headers are always separated from the message body with a blank line. When Thunderbird saves the message the blank line separating the headers from the body includes a CR. The patch detection is failing because a CRLF doesn't match /^$/. Fix this by allowing a CR to exist on the separating line. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4150-am.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 829660523..a0349182d 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -83,6 +83,12 @@ test_expect_success setup '
echo "X-Fake-Field: Line Three" &&
git format-patch --stdout first | sed -e "1d"
} > patch1.eml &&
+ {
+ 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"
+ } | append_cr >patch1-crlf.eml &&
sed -n -e "3,\$p" msg >file &&
git add file &&
test_tick &&
@@ -123,6 +129,15 @@ test_expect_success 'am applies patch e-mail not in a mbox' '
test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
'
+test_expect_success 'am applies patch e-mail not in a mbox with CRLF' '
+ git checkout first &&
+ git am patch1-crlf.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^)"
+'
+
GIT_AUTHOR_NAME="Another Thor"
GIT_AUTHOR_EMAIL="a.thor@example.com"
GIT_COMMITTER_NAME="Co M Miter"