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

Re: [PATCH] make the sample pre-commit hook script reject names with newlines, too

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Oct 22, 2011, 17:35 UTC
Message-ID
<m262jhoro1.fsf@igel.home>
In-Reply-To
<87obx9eygk.fsf@rho.meyering.net>
Jim Meyering <jim@meyering.net> writes:
Show 6 quoted lines
> @@ -26,7 +29,7 @@ if [ "$allownonascii" != "true" ] &&
>  	# even required, for portability to Solaris 10's /usr/bin/tr), since
>  	# the square bracket bytes happen to fall in the designated range.
>  	test "$(git diff --cached --name-only --diff-filter=A -z $against |
> -	  LC_ALL=C tr -d '[ -~]\0')"
> +	  LC_ALL=C tr -d '[ -~]\0' | wc -c)" != 0
This will fail if the output of wc contains leading spaces.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Previous: Jim MeyeringNext: Jim Meyering
Message 2 of 3 in “make the sample pre-commit hook script reject names with newlines, too”
  1. make the sample pre-commit hook script reject names with newlines, tooJim Meyering, Oct 22, 2011
  2. Andreas SchwabOct 22, 2011
  3. Jim MeyeringOct 22, 2011

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.