From 6900d750f4894e7bee714874c04cc14312cd91ec Mon Sep 17 00:00:00 2001 From: Christian Himpel Date: Fri, 25 Sep 2009 17:14:31 +0200 Subject: [PATCH 1/2] git-am: fixed patch_format detection according to RFC2822 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 Signed-off-by: Shawn O. Pearce --- git-am.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index 26ffe702e0..0ddd80fef9 100755 --- 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 From fa9d3485ead15387fd76a35284bd3ffb32d7c6c7 Mon Sep 17 00:00:00 2001 From: Christian Himpel Date: Fri, 25 Sep 2009 18:43:20 +0200 Subject: [PATCH 2/2] git-am: force egrep to use correct characters set According to egrep(1) the US-ASCII table is used when LC_ALL=C is set. We do not rely here on the LC_ALL value we get from the environment. Signed-off-by: Christian Himpel Signed-off-by: Shawn O. Pearce --- git-am.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index 0ddd80fef9..c132f50da5 100755 --- 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 '^[!-9;-~]+:' >/dev/null || + LC_ALL=C egrep -v '^[!-9;-~]+:' >/dev/null || patch_format=mbox fi } < "$1" || clean_abort