From: Junio C Hamano Date: Sat, 22 Aug 2009 01:47:44 +0000 (-0700) Subject: Merge branch 'bc/mailsplit-cr-at-eol' X-Git-Tag: v1.6.5-rc0~54 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bcd45e27d8790d8981d4c6734bc573363121efd3?ds=inline;hp=-c Merge branch 'bc/mailsplit-cr-at-eol' * bc/mailsplit-cr-at-eol: Allow mailsplit (and hence git-am) to handle mails with CRLF line-endings builtin-mailsplit.c: remove read_line_with_nul() since it is no longer used builtin-mailinfo,builtin-mailsplit: use strbufs strbuf: add new function strbuf_getwholeline() --- bcd45e27d8790d8981d4c6734bc573363121efd3 diff --combined git-am.sh index f719f6e654,985226bfec..5396be2279 --- a/git-am.sh +++ b/git-am.sh @@@ -191,27 -191,19 +191,33 @@@ check_patch_format () esac ;; esac + if test -z "$patch_format" && + test -n "$l1" && + test -n "$l2" && + test -n "$l3" + then + # This begins with three non-empty lines. Is this a + # piece of e-mail a-la RFC2822? Grab all the headers, + # 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" | + egrep -v '^[A-Za-z]+(-[A-Za-z]+)*:' >/dev/null || + patch_format=mbox + fi } < "$1" || clean_abort } split_patches () { case "$patch_format" in mbox) - git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || + case "$rebasing" in + '') + keep_cr= ;; + ?*) + keep_cr=--keep-cr ;; + esac + git mailsplit -d"$prec" -o"$dotest" -b $keep_cr -- "$@" > "$dotest/last" || clean_abort ;; stgit-series) @@@ -268,11 -260,7 +274,11 @@@ msgnum= ;; *) - clean_abort "Patch format $patch_format is not supported." + if test -n "$parse_patch" ; then + clean_abort "Patch format $patch_format is not supported." + else + clean_abort "Patch format detection failed." + fi ;; esac }