Code

git-am: fixed patch_format detection according to RFC2822
authorChristian Himpel <chressie@googlemail.com>
Fri, 25 Sep 2009 15:14:31 +0000 (17:14 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 25 Sep 2009 22:35:05 +0000 (15:35 -0700)
RFC2822 specifies in paragraph 3.6.8, that optional header fields are
made up of any printable US-ASCII character except ' ' (space) and ':'
(colon).

The pattern for the egrep command is changed to match all of these
characters.

Signed-off-by: Christian Himpel <chressie@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-am.sh

index 26ffe702e04e990113eb287f01be815d4ac8ad0a..0ddd80fef9f177b52bff726e33849f06613efce0 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -205,7 +205,7 @@ check_patch_format () {
                        # 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 ||
+                       egrep -v '^[!-9;-~]+:' >/dev/null ||
                        patch_format=mbox
                fi
        } < "$1" || clean_abort