git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pre-commit.sample: don't use [...] around a tr range

From
Jeff King <peff@peff.net>
Date
Sep 21, 2009, 14:21 UTC
Message-ID
<20090921142157.GA20860@sigio.peff.net>
In-Reply-To
<87tyywgzhu.fsf@meyering.net>
On Mon, Sep 21, 2009 at 04:10:21PM +0200, Jim Meyering wrote:
Show 13 quoted lines
> >>  	test "$(git diff --cached --name-only --diff-filter=A -z |
> >>  	  LC_ALL=C tr -d '[ -~]\0')"
> >
> > Does this work on non-bracket systems?
> 
> Yes, since [] happen to fall in the range.
> 
> > I would think that enumerating
> > the sequence would be the most portable thing.
> 
> Enumerating is more portable, at the expense of
> readability and maintainability.
> In case you want to go that route, here's one more:

Agreed. If we can avoid enumeration, we should. If your original is portable, then I think it is preferable. Thanks for looking into it.

-Peff
Previous: Jim MeyeringNext: Brandon Casey
Message 7 of 9 in “pre-commit.sample: don't use [...] around a tr range”
  1. pre-commit.sample: don't use [...] around a tr rangeJim Meyering, Sep 21, 2009
  2. Alex RiesenSep 21, 2009
  3. Jim MeyeringSep 21, 2009
  4. Alex RiesenSep 21, 2009
  5. Jeff KingSep 21, 2009
  6. Jim MeyeringSep 21, 2009
  7. Jeff KingSep 21, 2009
  8. Brandon CaseySep 21, 2009
  9. Jeff KingSep 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.