From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brandon Casey <casey@nrlssc.navy.mil>, git@vger.kernel.org
Subject: [PATCH] t6000lib: re-fix tr portability
Date: Fri, 14 Mar 2008 20:32:33 -0400 [thread overview]
Message-ID: <20080315003233.GA29209@coredump.intra.peff.net> (raw)
It seems that some implementations of tr don't like a
replacement string of '-----...'; they try to find the
double-dash option "---...".
Instead of this pipeline of tr and sed invocations, just use a
single perl invocation.
Signed-off-by: Jeff King <peff@peff.net>
---
I didn't see any complaints about increasing the use of perl in earlier
patches, so hopefully nobody minds. I think this is more portable, more
readable, and probably more efficient.
t/t6000lib.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/t/t6000lib.sh b/t/t6000lib.sh
index b69f7c4..c0baaa5 100755
--- a/t/t6000lib.sh
+++ b/t/t6000lib.sh
@@ -97,10 +97,13 @@ check_output()
# from front and back.
name_from_description()
{
- tr "'" '-' |
- tr '~`!@#$%^&*()_+={}[]|\;:"<>,/? ' \
- '------------------------------' |
- tr -s '-' | tr '[A-Z]' '[a-z]' | sed "s/^-*//;s/-*\$//"
+ perl -pe '
+ s/[^A-Za-z0-9.]/-/g;
+ s/-+/-/g;
+ s/-$//;
+ s/^-//;
+ y/A-Z/a-z/;
+ '
}
--
1.5.4.4.686.g851d
reply other threads:[~2008-03-15 0:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080315003233.GA29209@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=casey@nrlssc.navy.mil \
--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.
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).