git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Christian HimpelNext: Christian Himpel
Message 2 of 11 in “git-am: fixed patch_format detection according to RFC2822”
  1. 1/2 git-am: fixed patch_format detection according to RFC2822Christian Himpel, Sep 25, 2009
  2. 2/2 git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  3. 2/2 git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  4. git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  5. Jeff KingSep 27, 2009
  6. Christian HimpelSep 28, 2009
  7. Jeff KingSep 28, 2009
  8. Johannes SixtSep 28, 2009
  9. Christian HimpelSep 28, 2009
  10. Johannes SixtSep 28, 2009
  11. Christian HimpelSep 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.