summaryrefslogtreecommitdiff
path: root/git-am.sh
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 /git-am.sh
parentf4e6dcc36c37a6e62c8900ed657330356f6e2d8e (diff)
downloadgit-e3f67d30b20e49d8fc3eefe819808cba7998b060.tar.gz
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 'git-am.sh')
-rwxr-xr-xgit-am.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-am.sh b/git-am.sh
index 2f46fda47b..c8b9cbb101 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -205,7 +205,8 @@ check_patch_format () {
# discarding the indented remainder of folded lines,
# and see if it looks like that they all begin with the
# header field names...
- sed -n -e '/^$/q' -e '/^[ ]/d' -e p "$1" |
+ tr -d '\015' <"$1" |
+ sed -n -e '/^$/q' -e '/^[ ]/d' -e p |
sane_egrep -v '^[!-9;-~]+:' >/dev/null ||
patch_format=mbox
fi