{"thread":{"id":"12700","subject":"[PATCH] t6000lib: re-fix tr portability","startedAt":"2008-03-15T00:32:33Z","lastAt":"2008-03-15T00:32:33Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"72153","messageId":"20080315003233.GA29209@coredump.intra.peff.net","threadId":"12700","inReplyTo":null,"subject":"[PATCH] t6000lib: re-fix tr portability","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-03-15T00:32:33Z","receivedAt":"2008-03-15T00:32:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"It seems that some implementations of tr don't like a\nreplacement string of '-----...'; they try to find the\ndouble-dash option \"---...\".\n\nInstead of this pipeline of tr and sed invocations, just use a\nsingle perl invocation.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI didn't see any complaints about increasing the use of perl in earlier\npatches, so hopefully nobody minds. I think this is more portable, more\nreadable, and probably more efficient.\n\n t/t6000lib.sh |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t6000lib.sh b/t/t6000lib.sh\nindex b69f7c4..c0baaa5 100755\n--- a/t/t6000lib.sh\n+++ b/t/t6000lib.sh\n@@ -97,10 +97,13 @@ check_output()\n # from front and back.\n name_from_description()\n {\n-        tr \"'\" '-' |\n-\t\ttr '~`!@#$%^&*()_+={}[]|\\;:\"<>,/? ' \\\n-\t\t   '------------------------------' |\n-\t\ttr -s '-' | tr '[A-Z]' '[a-z]' | sed \"s/^-*//;s/-*\\$//\"\n+\tperl -pe '\n+\t\ts/[^A-Za-z0-9.]/-/g;\n+\t\ts/-+/-/g;\n+\t\ts/-$//;\n+\t\ts/^-//;\n+\t\ty/A-Z/a-z/;\n+\t'\n }\n \n \n-- \n1.5.4.4.686.g851d\n"}]}