From: Alexey Shumkin <alex.crezoff@gmail.com>
To: John Keeping <john@keeping.me.uk>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Sixt <j.sixt@viscovery.net>
Subject: Re: [PATCH] t4205: don't rely on en_US.UTF-8 locale existing
Date: Thu, 4 Jul 2013 00:40:24 +0400 [thread overview]
Message-ID: <20130703204024.GA6148@dell-note> (raw)
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:
> 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
>
next prev parent reply other threads:[~2013-07-03 20:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 20:18 [PATCH] t4205: don't rely on en_US.UTF-8 locale existing John Keeping
2013-07-03 20:40 ` Alexey Shumkin [this message]
2013-07-03 20:47 ` Alexey Shumkin
2013-07-03 21:41 ` Junio C Hamano
2013-07-03 21:53 ` John Keeping
2013-07-03 22:27 ` Alexey Shumkin
2013-07-03 22:25 ` Alexey Shumkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130703204024.GA6148@dell-note \
--to=alex.crezoff@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=john@keeping.me.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).