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

Re: [PATCH] t4205: don't rely on en_US.UTF-8 locale existing

From
Alexey Shumkin <alex.crezoff@gmail.com>
Date
Jul 3, 2013, 20:40 UTC
Message-ID
<20130703204024.GA6148@dell-note>
In-Reply-To
<f607decdc65b86b1759438e375ddf77fd5b91042.1372882590.git.john@keeping.me.uk>
CC this to Johannes Sixt
On Wed, Jul 03, 2013 at 09:18:08PM +0100, John Keeping wrote:
Show 49 quoted lines
> My system doesn't have the en_US.UTF-8 locale (or plain en_US), which
> causes t4205 to fail by counting bytes instead of UTF-8 codepoints.
> 
> Instead of using sed for this, use Perl which behaves predictably
> whatever locale is in use.
> 
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> This patch is on top of 'as/log-output-encoding-in-user-format'.
> 
>  t/t4205-log-pretty-formats.sh | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
> index 3cfb744..5864f5b 100755
> --- a/t/t4205-log-pretty-formats.sh
> +++ b/t/t4205-log-pretty-formats.sh
> @@ -20,9 +20,7 @@ commit_msg () {
>  		# cut string, replace cut part with two dots
>  		# $2 - chars count from the beginning of the string
>  		# $3 - "trailing" chars
> -		# LC_ALL is set to make `sed` interpret "." as a UTF-8 char not a byte
> -		# as it does with C locale
> -		msg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e "s/^\(.\{$2\}\)$3/\1../")
> +		msg=$(echo $msg | "$PERL_PATH" -CIO -pe "s/^(.{$2})$3/\1../")
>  	fi
>  	echo $msg
>  }
> @@ -205,7 +203,7 @@ test_expect_success 'left alignment formatting with ltrunc' "
>  ..sage two
>  ..sage one
>  add bar  Z
> -$(commit_msg "" "0" ".\{11\}")
> +$(commit_msg "" "0" ".{11}")
>  EOF
>  	test_cmp expected actual
>  "
> @@ -218,7 +216,7 @@ test_expect_success 'left alignment formatting with mtrunc' "
>  mess.. two
>  mess.. one
>  add bar  Z
> -$(commit_msg "" "4" ".\{11\}")
> +$(commit_msg "" "4" ".{11}")
>  EOF
>  	test_cmp expected actual
>  "
> -- 
> 1.8.3.1.747.g77f7d3a
> 
Previous: John KeepingNext: Alexey Shumkin
Message 2 of 7 in “t4205: don't rely on en_US.UTF-8 locale existing”
  1. t4205: don't rely on en_US.UTF-8 locale existingJohn Keeping, Jul 3, 2013
  2. Alexey ShumkinJul 3, 2013
  3. Alexey ShumkinJul 3, 2013
  4. Junio C HamanoJul 3, 2013
  5. John KeepingJul 3, 2013
  6. Alexey ShumkinJul 3, 2013
  7. Alexey ShumkinJul 3, 2013

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.