git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: John Keeping <john@keeping.me.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Alexey Shumkin <Alex.Crezoff@gmail.com>
Subject: Re: [PATCH] t4205: don't rely on en_US.UTF-8 locale existing
Date: Wed, 3 Jul 2013 22:53:03 +0100	[thread overview]
Message-ID: <20130703215303.GG9161@serenity.lan> (raw)
In-Reply-To: <7vr4ffcoel.fsf@alter.siamese.dyndns.org>

On Wed, Jul 03, 2013 at 02:41:06PM -0700, Junio C Hamano wrote:
> John Keeping <john@keeping.me.uk> writes:
> 
> > 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'.
> 
> Thanks.  I think Alexey is going to send incremental updates to the
> topic so I won't interfere by applying this patch on top of the
> version I have in my tree.
> 
> But I do agree that using Perl may be a workable solution.
> 
> An alternative might be not to use this cryptic 3-arg form of
> commit_msg at all.  They are used only for these three:
> 
> 	$(commit_msg "" "8" "..*$")
> 	$(commit_msg "" "0" ".\{11\}")
> 	$(commit_msg "" "4" ".\{11\}")
> 
> I somehow find them simply not readable, in order to figure out what
> is going on.
> 
> Just using three variables to hold what are expected would be far
> more portable and readable.
> 
> # "anfänglich" whatever it means.
> sample_utf8_part=$(printf "anf\303\244ng")
> 
> commit_msg () {
> 	msg="initial. ${sample_utf8_part}lich";
> 	if test -n "$1"
> 	then
> 		echo "$msg" | iconv -f utf-8 -t "$1"
> 	else
> 		echo "$msg"
>         fi
> }
> 
> And then instead of writing in the expected test output.
> 
> 	$(commit_msg "" "8" "..*$")
> 	$(commit_msg "" "0" ".\{11\}")
> 	$(commit_msg "" "4" ".\{11\}")
> 
> we can just say
> 
> 	initial...
>         ..an${sample_utf8_part}lich
> 	init..lich
> 
> It is no worse than those cryptic 0, 4, 8 and 11 magic numbers we
> see in the test, no?

That's probably better since we don't need to rely on some other tool
getting it right.

Alexey, will you incorporate this change in your incremental updates?

  reply	other threads:[~2013-07-03 21:53 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
2013-07-03 20:47   ` Alexey Shumkin
2013-07-03 21:41 ` Junio C Hamano
2013-07-03 21:53   ` John Keeping [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130703215303.GG9161@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=Alex.Crezoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).