All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Shumkin <alex.crezoff@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: John Keeping <john@keeping.me.uk>,
	git@vger.kernel.org, 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 02:25:08 +0400	[thread overview]
Message-ID: <20130703222508.GC6148@dell-note> (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?
Yep!
when I was thinking about Johannes's suggestions, I finally came to the decision
alike yours.

      parent reply	other threads:[~2013-07-03 22:25 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
2013-07-03 22:27     ` Alexey Shumkin
2013-07-03 22:25   ` Alexey Shumkin [this message]

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=20130703222508.GC6148@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.