[PATCH 2/2] git-am: force egrep to use correct characters set
- From
Christian Himpel <chressie@googlemail.com>
- Date
- Sep 25, 2009, 15:17 UTC
- Message-ID
- <dc8a4205128d65e69587292a42c714792315a9df.1253891124.git.chressie@gmail.com>
- In-Reply-To
- <d7d039c304614d8d39fd2e7ad8d036a77121cc4f.1253891124.git.chressie@gmail.com>
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 <chressie@gmail.com> ---
I don't know if this kind of patch is desired, but according to egrep(1) it's not reliable to use the range expression with different character sets than US-ASCII.
So this patch forces the usage of US-ASCII.
Regards, chressie
git-am.sh | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/git-am.sh b/git-am.sh index 0ddd80f..e4dd49a 100755 --- a/git-am.sh +++ b/git-am.sh @@ -204,9 +204,13 @@ 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... + _tmp_locale=$LC_ALL + export LC_ALL=C sed -n -e '/^$/q' -e '/^[ ]/d' -e p "$1" | egrep -v '^[!-9;-~]+:' >/dev/null || patch_format=mbox + export LC_ALL=$_tmp_locale + unset $_tmp_locale fi } < "$1" || clean_abort }
-- 1.6.4.4